-
-
Notifications
You must be signed in to change notification settings - Fork 796
Description
Describe the bug
When defining the accept param as per Docs/TypeScript definition:
accept: {
'image/jpeg': ['.jpeg', '.png']
}
The rejected message is File type must be image/jpeg,.jpeg,.png
instead of what is expected `File type must be one of x, y, z. Which is not very user friendly, especially as there are no spaces applied.
To Reproduce
Steps to reproduce the behavior:
- Go to https://codesandbox.io/s/react-dropzone-example-forked-qcic4f?file=/src/App.js
- Choose a gif file
- See error
Expected behavior
File type must be one of .jpeg, .png.
Additional context
It seems the rejected util does not perform as expected with the new accept
param/the data it's been given. (https://github.com/react-dropzone/react-dropzone/blob/master/src/utils/index.js#L17-L26)
Would be nice to be able to provide custom error messages to override the OOTB ones.
For reference, in version 11.7.1 of react-dropzone, the rejected error message was better: File type must .jpeg, .png - spaces were applied. I assume v13.0.0 introduced the bug.