diff options
author | ThibG <thib@sitedethib.com> | 2020-04-25 12:27:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-25 12:27:29 +0200 |
commit | be637146f310d7ec3a49d01e850959514e9e4964 (patch) | |
tree | dd872d2a9ea527f37add1ee8dbe16c3bb26d2b72 /app/javascript | |
parent | c955f98d36868e85b0f1939a3a1c58c00babd4e8 (diff) |
Fix uninformative error message when uploading unsupported image files (#13540)
Attempting to upload image files that the browser is unable to load results in “Oops! An unexpected error occurred.” This commit changes the error handling so that an unprocessable image results in the file being sent anyway, which might cover a few corner cases, and provide a slightly better error message.
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/mastodon/utils/resize_image.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/javascript/mastodon/utils/resize_image.js b/app/javascript/mastodon/utils/resize_image.js index 710a08f7c..6c1cb61a2 100644 --- a/app/javascript/mastodon/utils/resize_image.js +++ b/app/javascript/mastodon/utils/resize_image.js @@ -138,7 +138,7 @@ const resizeImage = (img, type = 'image/png') => new Promise((resolve, reject) = .catch(reject); }); -export default inputFile => new Promise((resolve, reject) => { +export default inputFile => new Promise((resolve) => { if (!inputFile.type.match(/image.*/) || inputFile.type === 'image/gif') { resolve(inputFile); return; @@ -153,5 +153,5 @@ export default inputFile => new Promise((resolve, reject) => { resizeImage(img, inputFile.type) .then(resolve) .catch(() => resolve(inputFile)); - }).catch(reject); + }).catch(() => resolve(inputFile)); }); |