The dropzone component reads from the selected file to gather and display additional information about the selected file(s). Errors thrown while reading lead to react crashing. Those kind of errors are neither catched, nor catchable by the parent component.
This PR:
adds the necessary catch and displays the affected files as an error notification
adds a new prop that allows customizing the error messages (similar to the success message when files have been added)
Related:
268 does not crash anymore, but shows a message instead
Type of change
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
How Has This Been Tested
On Linux:
Create a file
Change permissions to 400 (only file owner can read)
Change the fileowner to someone else, e.g. root
Try to select that file with the dropzone
Without this PR, react will crash because the error thrown by FileReader API is not catched
With this PR, the error will be handled gracefully
Alternatively you can try uploading a very large file, e.g. a few GB. This also results in a FileReader error
Test Configuration:
Browser:
Firefox 92
Checklist
[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my own code
[x] I have commented my code, particularly in hard-to-understand areas
[x] I have made corresponding changes to the documentation
[x] My changes generate no new warnings
[x] Any dependent changes have been merged and published in downstream modules
Description
The dropzone component reads from the selected file to gather and display additional information about the selected file(s). Errors thrown while reading lead to react crashing. Those kind of errors are neither catched, nor catchable by the parent component.
This PR:
Related:
268 does not crash anymore, but shows a message instead
Type of change
How Has This Been Tested
On Linux:
Alternatively you can try uploading a very large file, e.g. a few GB. This also results in a FileReader error Test Configuration:
Checklist