Editor: Make mime type config less confusing
See original GitHub issueTask Description
We currently pass this list of mime/file types to the editor:
As we are working on some documentation on using the decoupled story editor, it became more obvious how confusing this config is.
allowedMimeTypes
: map of allowed mime types for actual story elements. For example,allowedMimeTypes.image
might containimage/svg+xml
or something to say that you can drop SVGs on the canvasallowedImageMimeTypes
: this is used for places in the design/document tab where you can upload images (video poster, story poster, publisher logo). For example, here we would never want to allow uploading SVGs. Hence this separate config.allowedAudioMimeTypes
: similarly, this is used for when you want to add background audio to a page.
In addition to that, allowedFileTypes
is just a simple array of file types so that in the editor we can say “You are only allowed to upload jpeg, png, gif” etc. We can just get rid of this and use getExtensionFromMimeType
from the media
package instead.
allowedTranscodableMimeTypes
is really pointless too, which is why I opened #10591 for that already.
To-do
- Rename
allowedMimeTypes
to somehting more obvious, like for exampleallowedElementMimeTypes
- Maybe rename
allowedImageMimeTypes
andallowedAudioMimeTypes
to something more obvious too - Make
allowedFileTypes
obsolete by assembling that on-the-fly in the editor instead, usinggetExtensionFromMimeType
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Properly configuring server MIME types - MDN Web Docs
If a web server or application reports an incorrect MIME type for content (including a "default type" for unknown content), a web browser...
Read more >arch linux - Digging deeper into differing mime-type associations
It is normal to have different mime-type file associations on different systems, even when those systems are running the same version of the ......
Read more >How to add *.less to IIS 7.0? - Stack Overflow
There is no need to add a handler. Just add a MIME type (now known as Internet Media Type) for .less and set...
Read more >All known MIME types - mimetype.io
KRA is the file format for Krita, a raster graphics editor. It is a ZIP archive containing a number of files, including the...
Read more >Files starting with a comment have the wrong mime type
I've tried editing the /etc/mime.types file to make the system aware of the extension. First I added less as an extension of text/css...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There might be a problem with passing down mime types and getting an extension array in the case of
image/jpeg
since both.jpeg
and.jpg
have the mime-typeimage/jpeg
. ifallowedImageMimeTypes
is['image/jpeg']
allowedImageFileTypes
would be['jpeg']
butMediaUpload
would accept bothjpeg
andjpg
files.Precisely. That’s what I meant in the ticket description by saying we can make it obsolete.