From f993cc8bcbf6483bc7b986e905333645c03d4f1b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 16 Jun 2020 12:52:54 +0200 Subject: [PATCH] Do not attempt to resize non-images in attachment upload Fixes #3059 --- wcfsetup/install/files/js/WCF.Attachment.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wcfsetup/install/files/js/WCF.Attachment.js b/wcfsetup/install/files/js/WCF.Attachment.js index d170624e21..b31e5ff72e 100644 --- a/wcfsetup/install/files/js/WCF.Attachment.js +++ b/wcfsetup/install/files/js/WCF.Attachment.js @@ -333,6 +333,12 @@ WCF.Attachment.Upload = WCF.Upload.extend({ // As our resizer is based on Pica it will use multiple workers per image if possible. promise = Array.prototype.reduce.call(files, (function (acc, file) { return acc.then((function (arr) { + // Ignore anything that is not one of the 3 basic image types. + if (['image/png', 'image/gif', 'image/jpeg'].indexOf(file.type) === -1) { + arr.push(file); + return arr; + } + var timeout = new Promise(function (resolve, reject) { // We issue one timeout per image, thus multiple timeout // handlers will run in parallel -- 2.20.1