Skip to content

Commit

Permalink
prevent thumbnail generation on wrong mimetype (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
mszulik authored Aug 8, 2024
1 parent bf643d7 commit 44e39c7
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions amigor/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amigor/public/vendor/transmorpher/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/transmorpher.js": "/transmorpher.js?id=87f85bfe73123b6a5abd7f638bd951ed",
"/transmorpher.js": "/transmorpher.js?id=1583a86bf2270919b4e8e6750dfbdf5c",
"/transmorpher.css": "/transmorpher.css?id=56dbb0cba726c3e63f1c109f6b9a6f1b",
"/icons/delete.svg": "/icons/delete.svg?id=f88179ccc3649c47f2264315be6c0421",
"/icons/enlargen.svg": "/icons/enlargen.svg?id=9f560ce3f022646dbb826a066715a343",
Expand Down
7 changes: 2 additions & 5 deletions amigor/public/vendor/transmorpher/transmorpher.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ if (!window.transmorpherScriptLoaded) {
dictDefaultMessage: medium.translations['drop_files_to_upload'],
dictFileTooBig: medium.translations['max_file_size_exceeded'],
dictInvalidFileType: medium.translations['invalid_file_type'],
createImageThumbnails: false,
init: function init() {
// Processing-Event is emitted when the upload starts.
this.on('processing', function () {
Expand Down Expand Up @@ -123,11 +124,7 @@ if (!window.transmorpherScriptLoaded) {
if (errorElement = this.element.querySelector('.dz-error')) {
errorElement.remove();
}

// Dropzone only emits the "thumbnail" event for images.
if (!file.type.match(/image.*/)) {
this.emit("thumbnail", file);
}
this.emit("thumbnail", file);
},
// Update database when upload was canceled manually.
canceled: function canceled(file) {
Expand Down
2 changes: 1 addition & 1 deletion dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/transmorpher.js": "/transmorpher.js?id=87f85bfe73123b6a5abd7f638bd951ed",
"/transmorpher.js": "/transmorpher.js?id=1583a86bf2270919b4e8e6750dfbdf5c",
"/transmorpher.css": "/transmorpher.css?id=56dbb0cba726c3e63f1c109f6b9a6f1b",
"/icons/delete.svg": "/icons/delete.svg?id=f88179ccc3649c47f2264315be6c0421",
"/icons/enlargen.svg": "/icons/enlargen.svg?id=9f560ce3f022646dbb826a066715a343",
Expand Down
7 changes: 2 additions & 5 deletions dist/transmorpher.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ if (!window.transmorpherScriptLoaded) {
dictDefaultMessage: medium.translations['drop_files_to_upload'],
dictFileTooBig: medium.translations['max_file_size_exceeded'],
dictInvalidFileType: medium.translations['invalid_file_type'],
createImageThumbnails: false,
init: function init() {
// Processing-Event is emitted when the upload starts.
this.on('processing', function () {
Expand Down Expand Up @@ -123,11 +124,7 @@ if (!window.transmorpherScriptLoaded) {
if (errorElement = this.element.querySelector('.dz-error')) {
errorElement.remove();
}

// Dropzone only emits the "thumbnail" event for images.
if (!file.type.match(/image.*/)) {
this.emit("thumbnail", file);
}
this.emit("thumbnail", file);
},
// Update database when upload was canceled manually.
canceled: function canceled(file) {
Expand Down
6 changes: 2 additions & 4 deletions src/resources/js/transmorpher.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ if (!window.transmorpherScriptLoaded) {
dictDefaultMessage: medium.translations['drop_files_to_upload'],
dictFileTooBig: medium.translations['max_file_size_exceeded'],
dictInvalidFileType: medium.translations['invalid_file_type'],
createImageThumbnails: false,
init: function () {
// Processing-Event is emitted when the upload starts.
this.on('processing', function () {
Expand Down Expand Up @@ -108,10 +109,7 @@ if (!window.transmorpherScriptLoaded) {
errorElement.remove();
}

// Dropzone only emits the "thumbnail" event for images.
if (!file.type.match(/image.*/)) {
this.emit("thumbnail", file);
}
this.emit("thumbnail", file);
},
// Update database when upload was canceled manually.
canceled: function (file) {
Expand Down

0 comments on commit 44e39c7

Please sign in to comment.