-
Notifications
You must be signed in to change notification settings - Fork 179
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
Editor: Make mime type config less confusing #10709
Conversation
* Add new `getExtensionsFromMimeType` function * Missed one. * Fix jpeg. Co-authored-by: Jonny Harris <[email protected]>
I have made some tweaks to the Type class, to remove unneeded methods. I would strongly consider removing the |
Yes we should remove the unused code 👍 |
packages/story-editor/src/components/panels/shared/captionsPanelContent.js
Outdated
Show resolved
Hide resolved
packages/story-editor/src/components/panels/shared/captionsPanelContent.js
Outdated
Show resolved
Hide resolved
What is happening with this pr? |
There are some karma test failures after merging Also, fixed the spaces vs tabs issue for you. |
packages/story-editor/src/components/panels/shared/captionsPanelContent.js
Outdated
Show resolved
Hide resolved
Karma tests are now passing. I missed one last place that had not been changed. |
Context
Summary
Make the handling of mime types and file extensions much simpler, by scaling back. This scaling back includes.
allowedFileTypes
allowedImageFileTypes
allowedImageMimeTypes
allowedAudioFileTypes
allowedAudioMimeTypes
get_allowed_file_types
get_allowed_image_mime_types
get_allowed_audio_mime_types
web_stories_allowed_image_mime_types
Make
get_allowed_mime_types
a single point of truth for all mime types that are handled by the editor / dashboard.Do not add image/svg to image types by a new key vector key. This means image mime should all be considered web safe.
Relevant Technical Choices
Now all mime types are checked against if WordPress can upload them. That means that aacs are removed, because multisite can not handle this file type. There is a unit test to prove this and a skipped test.
There are some hardcoded mime type mapping, as these mime types are return the wrong file extensions or no file extension at all. This can not avoided sadly.
Handling of file extensions is now done in javascript and passing in file extensions to the config object.
To-do
User-facing changes
Testing Instructions
This PR can be tested by following these steps:
Reviews
Does this PR have a security-related impact?
Does this PR change what data or activity we track or use?
Does this PR have a legal-related impact?
Checklist
Type: XYZ
label to the PRFixes #10592