Skip to content

Blocks: File block doesn't handle unallowed file types #8025

@aduth

Description

@aduth

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:

  1. Navigate to Posts > Add New
  2. Drag an unsupported file from your computer to the editor (maybe .exe)
  3. Observe that a file block is inserted (since it handles any files dropped), but that it pulses forever
  4. Save the post
  5. Reload the editor
  6. 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):

loading

Error:

image

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)

Metadata

Metadata

Assignees

Labels

[Feature] BlocksOverall functionality of blocks[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions