-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Describe the bug
The Files block fails to handle the case where a user drops a file type not allowed by the server. It presents the loading display forever. If the user then proceeds to save the post and reload the page, the block fails with an unhandled error.
To Reproduce
Steps to reproduce the behavior:
- Navigate to Posts > Add New
- Drag an unsupported file from your computer to the editor (maybe
.exe
) - Observe that a file block is inserted (since it handles any files dropped), but that it pulses forever
- Save the post
- Reload the editor
- Observe that the File block has encountered an error
Expected behavior
- The Files block should not attempt to handle unsupported file types
- Insertion point shouldn't be offered
- Even if it tried to handle, if the upload failed for any reason, this should at least be communicated to the user
- There should be no block errors when reloading the saved post
Screenshots
Uploading (indefinitely):
Error:
Error text:
mediaupload.js:83 Uncaught TypeError: Cannot read property 'type' of undefined
at mediaupload.js:83
at Array.forEach ()
at mediaUpload (mediaupload.js:82)
at editorMediaUpload (index.js:33)
at FileEdit.componentDidMount (edit.js:58)
at commitLifeCycles (react-dom.24169eaf.js:14939)
at commitAllLifeCycles (react-dom.24169eaf.js:16040)
at HTMLUnknownElement.callCallback (react-dom.24169eaf.js:140)
at Object.invokeGuardedCallbackDev (react-dom.24169eaf.js:178)
at invokeGuardedCallback (react-dom.24169eaf.js:227)
Desktop (please complete the following information):
- OS: macOS High Sierra 10.13.6 (17G65)
- Browser: Chrome Version 67.0.3396.99 (Official Build) (64-bit)