onurzorluer / react-image-file-resizer

Resize Local Images with React 🌄 🌅
MIT License
317 stars 41 forks source link

Fix bug "Uncaught TypeError: Cannot read property 'name' of undefined" #47

Closed OverStruck closed 3 years ago

OverStruck commented 3 years ago

Fixes a small bug that throws error index.js:1 Uncaught TypeError: Cannot read property 'name' of undefined when using the file outputType parameter.

This bug is happens because the variable file is being overwritten when creating a new file using const file = new File(xxx) So just changing the name of this variable to something else to get rid of the error and to not overwrite the original file variable used in the code.