ericnograles / browser-image-resizer

A tiny browser-based library to downscale and/or resize images using canvas
MIT License
98 stars 42 forks source link

Should reject readAndCompressImage's promise when reader or img encounter error #28

Closed jasonkit closed 2 years ago

jasonkit commented 4 years ago

Right now, if someone feed in a corrupted image file, readAndCompressImage's promise will never finish.

ericnograles commented 3 years ago

Thanks for the contribution @jasonkit -- I did a recent refactor which also addresses this -- if you have a chance, can you re-test with v2.2.0 and lmk if it behaves as expected? Thanks!

jasonkit commented 3 years ago

@ericnograles No, it still not working, I think you need to add onerror to img and reader in readAndCompressImage and call reject there as well. (you can refer to my PR: https://github.com/ericnograles/browser-image-resizer/pull/29/files)

ericnograles commented 3 years ago

Ah I see. Let me get those changes in this week and I'll send to you for review if that's ok?

ericnograles commented 3 years ago

@jasonkit merged master into your branch and reinstated your changes -- pushed to PR #29, can you review when you get a minute? Just wanna make sure you get credit for this PR in GitHub.

AdamStone commented 2 years ago

@ericnograles can you comment on why #29 was never merged? These cases still fail silently and never resolve.

ericnograles commented 2 years ago

@AdamStone oops, that was a miss. Will merge and cut a new release in the next day or so.