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

Fix/only allow svg when uploading #228

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

darylldoyle
Copy link
Collaborator

@darylldoyle darylldoyle commented Sep 26, 2024

Description of the Change

Updates the plugin to only add SVGs as an allowed type, when the sanitiser will be able to run on those files.

How to test the Change

Changelog Entry

Added - New feature
Changed - Existing functionality
Deprecated - Soon-to-be removed feature
Removed - Feature
Fixed - Bug fix
Security - Vulnerability
Developer - Non-functional update

Credits

Props @username, @username2, ...

Checklist:

@darylldoyle darylldoyle self-assigned this Sep 26, 2024
@github-actions github-actions bot added this to the 2.3.0 milestone Sep 26, 2024
Copy link

@darylldoyle thanks for the PR! Could you please fill out the PR template with description, changelog, and credits information so that we can properly review and merge this?

@github-actions github-actions bot added needs:feedback This requires feedback to determine next steps. needs:code-review This requires code review. and removed needs:feedback This requires feedback to determine next steps. labels Sep 26, 2024
Copy link
Collaborator

@dkotter dkotter left a comment

Choose a reason for hiding this comment

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

So this doesn't work for me, I always get the Sorry, you are not allowed to upload this file type error message.

I think what's happening is there's an earlier mime check that fires before the wp_handle_upload_prefilter filter and since we aren't adding the svg mime until that filter runs, things no longer work.

To test, I'm in the Media Library admin page, with the Grid View on. If I drag and drop an svg image, I get the above error.

@dkotter
Copy link
Collaborator

dkotter commented Sep 26, 2024

I was curious on how our E2E tests were passing here when I couldn't get things to work. Looking into that, the uploadMedia command we use goes to /wp-admin/media-new.php and uploads from there. If I go to that page directly, I can upload svgs just fine but as mentioned above, I can't upload svgs from the main Media Library screen, which is interesting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-review This requires code review.
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants