[wp-trac] [WordPress Trac] #39550: Some Non-image files fail to upload after 4.7.1

WordPress Trac noreply at wordpress.org
Fri Jan 13 10:36:17 UTC 2017


#39550: Some Non-image files fail to upload after 4.7.1
---------------------------+------------------------
 Reporter:  greatislander  |       Owner:  joemcgill
     Type:  defect (bug)   |      Status:  assigned
 Priority:  normal         |   Milestone:  4.7.2
Component:  Upload         |     Version:  trunk
 Severity:  normal         |  Resolution:
 Keywords:  needs-patch    |     Focuses:
---------------------------+------------------------

Comment (by mensmaximus):

 While playing around with the mime types I just noticed the function
 wp_get_ext_types() which defines extensions separately. This sounds to me
 redundant and may lead to further issues if those definitions get out of
 sync.

 Within wp_check_filetype_and_ext() there is ounce more an array
 ($mime_to_ext) defining mime-extension pairs.

 Maybe those functions and definitions should be combined like returning an
 array with all informations together like

 {{{
 default_mimes = array(
         'extension_1' => array(
                 'group' => 'images'
                 ),
                 'mimes' => array(
                         'mime_type_1',
                         'mime_type_2'
                 ),
                 'roles_allowed' => array(
                         'administrator',
                         'publisher'
                 )
         ),
         'extension_2' => array(
                 'group' => 'audio'
                 ),
                 'mimes' => array(
                         'mime_type_1',
                         'mime_type_2'
                 ),
                 'roles_allowed' => array(
                         'administrator',
                         'publisher'
                 )
         )
 );
 }}}

 For backward compatibility functions like wp_get_ext_types() could than
 simply fetch the array and rebuild the formerly used array to return it.

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


More information about the wp-trac mailing list