[wp-trac] [WordPress Trac] #40175: Upload Validation / MIME Handling
WordPress Trac
noreply at wordpress.org
Tue May 5 11:07:28 UTC 2020
#40175: Upload Validation / MIME Handling
-------------------------------------------------+-------------------------
Reporter: blobfolio | Owner: (none)
Type: defect (bug) | Status: assigned
Priority: high | Milestone: Future
| Release
Component: Media | Version: 4.7.3
Severity: major | Resolution:
Keywords: has-unit-tests early needs-dev-note | Focuses:
| administration
-------------------------------------------------+-------------------------
Comment (by benz001):
Not sure if this is best listed as a new feature request or a comment on
this one, but to add another couple of examples to this: .DWG files can be
`'dwg' => 'image/vnd.dwg'` or `'dwg' => 'text/plain'` similarly DXF files
can be `'dxf' => 'text/plain'` or `'dxf' => 'application/octet-stream'`
and possibly more. Both formats support text and binary versions of their
extensions. SVGs can do a similar thing.
As far as I can tell the `add_custom_mime_types` filter allows for adding
new extensions and for multiple extensions to map to the same type, but
not the reverse ie multiple types per extension can't be added.
Hence the need discussed above (and here
https://wordpress.stackexchange.com/questions/323750/how-to-assign-
multiple-file-mime-types-to-extension/346169#346169) to loop around the
check and retry with a new mime type array.
For us, we regularly hit this when users attempt to submit drawings of
various types through a gravity forms contact form.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40175#comment:81>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list