Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a warning when a disallowed filetype is dropped on a MediaUpload #9578

Merged
merged 6 commits into from
Sep 3, 2018

Conversation

pento
Copy link
Member

@pento pento commented Sep 3, 2018

Description

When trying to upload a disallowed filetype to a file block, or an unsupported filetype to a restricted block (eg, a zip file to an image block), there's no feedback saying why the upload failed.

This PR re-arranges the filetype checking a little, to ensure a message is triggered on the former case, and adds a new message for the latter. It also adds the filename to each warning, so the person uploading the files knows which files caused which warning.

Fixes #9467.

How has this been tested?

  • Upload a blocked file (eg, foo.exe) to a file block.
  • Upload an allowed, but unsupported file (eg, bar.zip) to an image block.

Screenshots

screenshot of the image block showing the error messages

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@pento pento added this to the 3.8 milestone Sep 3, 2018
@pento pento requested a review from a team September 3, 2018 14:29
message: [
<strong key="filename">{ mediaFile.name }</strong>,
': ',
__( 'Sorry, this file type is not supported by this block.' ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're outside of the block's code in this function, it can be used in a block agnostic context. Should remove "block" from the message and the code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@pento pento merged commit 375fdc0 into master Sep 3, 2018
@pento pento deleted the fix/9497-show-warning-for-disallowed-files branch September 3, 2018 15:12
@aduth aduth mentioned this pull request Sep 6, 2018
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants