IsDragReject evaluating to true even though no error were fired.
See original GitHub issueDo you want to request a feature or report a bug?
- [ X] I found a bug
- I want to propose a feature
What is the current behavior? Able to drop image but getting isDragReject true which leds to unexpected UI error treatments https://codesandbox.io/s/wandering-tdd-ehs4e
What is the expected behavior? Be able to drop an image and do not get isDragReject with truthy value.
If this is a feature request, what is motivation or use case for changing the behavior? After investigation, I realized that this behavior was inserted by #878.
On this method
export function fileMatchSize(file, maxSize, minSize) { return file.size <= maxSize && file.size >= minSize; }
file.size is undefined which leads to a falsy evaluation, and this file param is a DataTransferItem defined in here: DataTransferItem , having only two read-only props, kind and type, maybe we should use getAsFile method in order to have access to file itself, but on my local it returns undefined.
Please mention other relevant information such as the browser version, Operating System and react-dropzone version. Browser Version: Chrome 77.0.3865.90 OS: Window 10 Pro React Dropzone Version: 10.1.10
Thanks, let me know if I can help somehow.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:18
- Comments:16
Top GitHub Comments
The issue remains in the scenario if I have
accept = ".txt,.doc,.docx"
that is a list of comma-separated file extensions. With MIME types it works smoothly.I’m having this same issue on accept
".jpg, .png, .svg"
. It fails whatever is the extension of the file.