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

File block prevents .zip and other files from being uploaded to a blog #33187

Closed
pansamolot opened this issue Jul 4, 2021 · 2 comments
Closed
Labels
[Block] File Affects the File Block [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed

Comments

@pansamolot
Copy link

Description

I am unable to upload through File block any application/zip (.zip) files. Other zip-related extensions as well (i.e. application/epub+zip). File block claims that file type is not permitted for security reasons. In the same time uploading exactly the same files through Media section works like a charm.

All necessary conditions are met even high above expectations, i.e.:

  1. I am a super-admin in my network.
  2. The ALLOW_UNFILTERED_UPLOADS flag is set to true
  3. Custom hook of $existing_mimes['zip'] = 'application/zip'; is added
  4. Uploading .zip files is allowed in my network:

enter image description here

  1. the Enhanced Media Library extension clearly shows that this MIME type is added:

enter image description here

Step-by-step reproduction instructions

  1. Create any File block
  2. Click "Upload" button and select any .zip file on your disk
  3. Click "OK" to start upload

Expected behaviour

File is uploaded to Wordpress and correctly linked to File block.

Actual behaviour

File is not uploaded and "Sorry, this file type is not permitted for security reasons" error is displayed instead.

Screenshots

An animation showing that uploading the same file is not possible when uploaded directly to blog post and to File block, while is possible when doing the same in "Media" section of a blog network.

two

WordPress information

  • WordPress version: 5.7.2
  • Gutenberg version: Version 10.9.1 | By Gutenberg Team
  • Are all plugins except Gutenberg deactivated? No
  • Are you using a default theme (e.g. Twenty Twenty-One)? No

Device information

  • Device: PC
  • Operating system: Windows 10 10094
  • Browser: Chrome Version 91.0.4472.114
@talldan
Copy link
Contributor

talldan commented Jul 5, 2021

@pansamolot Thanks for reaching out. This was previously reported in #23510, there's a lot of info on that issue that may be of help. From reading it's not clear to me whether this is still a WordPress core issue, maybe both? The related trac ticket is still open - https://core.trac.wordpress.org/ticket/40175.

I'll close this in favour of the existing issue/ticket.

@talldan talldan closed this as completed Jul 5, 2021
@talldan talldan added [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Block] File Affects the File Block labels Jul 5, 2021
@rjcalifornia
Copy link

Description

I am unable to upload through File block any application/zip (.zip) files. Other zip-related extensions as well (i.e. application/epub+zip). File block claims that file type is not permitted for security reasons. In the same time uploading exactly the same files through Media section works like a charm.

All necessary conditions are met even high above expectations, i.e.:

1. [I am a super-admin](https://core.trac.wordpress.org/ticket/45818) in my network.

2. The `ALLOW_UNFILTERED_UPLOADS` flag [is set to `true`](https://onezeronull.com/2021/05/12/file-upload-blocked-despite-allow_unfiltered_uploads-set-to-true/#enable-upload-of-all-files)

3. [Custom hook](https://wordpress.stackexchange.com/a/387876/17323) of `$existing_mimes['zip'] = 'application/zip';` is added

4. Uploading .zip files is allowed in my network:

For some reason, this is not being picked up by the ALLOW_UNFILTERED_UPLOADS. I made a small fix, may be that can help:

https://github.com/rjcalifornia/fixzip_upload

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] File Affects the File Block [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed
Projects
None yet
Development

No branches or pull requests

3 participants