[wp-trac] [WordPress Trac] #40175: Upload Validation / MIME Handling

WordPress Trac noreply at wordpress.org
Fri Sep 13 21:44:12 UTC 2019


#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 jesin):

 Today I faced an issue while uploading a docm file because fileinfo
 returns ''application/vnd.openxmlformats-
 officedocument.wordprocessingml.document'' as the MIME type while
 WordPress returns ''application/vnd.ms-word.document.macroEnabled.12''.

 I had to use the following workaround:

 {{{
 add_filter( 'upload_mimes', function( $mime_types ) {
         $mime_types['docm'] = 'application/vnd.openxmlformats-
 officedocument.wordprocessingml.document';
         return $mime_types;
 }, 1, 1 );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/40175#comment:74>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list