dfa1234 / ngx-image-compress

Angular library for uploading and compressing images
https://image-library.app
MIT License
87 stars 36 forks source link

Invalid image - onerror event not handled, promise never rejected #60

Closed speedclaud closed 2 years ago

speedclaud commented 3 years ago

Hi, thanks for this awesome lib. I have a problem though. When I try to compress a corrupted / invalid file, I never get any resolve or reject from compressFile's promise. I've looked though your code and the problem seems to be that you handle the onload event (image-compress.ts:118) on the Image object you use for the compression, but you don't handle onerror to reject the promise in case of invalid images.

Please add the .onerror callback containing a reject(error), so the app doesn't loop forever.

Thanks!

dfa1234 commented 2 years ago

Fixed in version 13+