From: Tim Düsterhus Date: Tue, 16 Jun 2020 10:52:54 +0000 (+0200) Subject: Do not attempt to resize non-images in attachment upload X-Git-Tag: 5.3.0_Alpha_1~213 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f993cc8bcbf6483bc7b986e905333645c03d4f1b;p=GitHub%2FWoltLab%2FWCF.git Do not attempt to resize non-images in attachment upload Fixes #3059 --- 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