Open thany opened 2 years ago
Hi! Did you find a solution to this? I'm facing the same problem trying to write some test using mock data
No, but I imagine forking this project might not be a bad idea, seeing how development on this project is not exactly super active. It doesn't seem like it should be awfully difficult to fix.
(not meant to belittle the author - I'm sure he/she has other priorities)
I also found that certain PNGs also produce an indeterminate result. I tried these:
This is just what I happen to have at hand. More testing is neccesary to get to a safe conclusion, but it seems like large PNG might be the possible culprit. I currently have no way to be sure how large is too large, if that's the problem.
I'm pretty sure this is new. I've seen the above two failing PNGs work, but somehow it's now broken.
Describe the bug When passing a file that isn't an image, AND doesn't have a
type
, the function never produces a usable result. TheresponseUriFunc
is never called, and an error is never thrown.To Reproduce Steps to reproduce the behavior:
new File([ /* presumably any data will do */ ], 'foo', { type: '' })
responseUriFunc
and any thrown errors by wrapping theResizer.imageFileResizer
in a try-catch.Expected behavior Either of these options:
responseUriFunc
callback is called with an empty/undefined parameter. Not recommended, but it might be the last option if the above two can't work.I noticed in the source code that if the filetype is empty, you just carry on trying to resize the image, which isn't an image. Filetype could never be empty in practice. Any file that is resizable, must also be recognized by the browser, and therefor must also have a valid filetype. Letting empty filetypes through seems like a bad idea.
Desktop (please complete the following information):