[wp-trac] [WordPress Trac] #46544: mp3 file with different file mime type and content type when uploading should not be rejected

WordPress Trac noreply at wordpress.org
Mon Mar 18 19:04:07 UTC 2019


#46544: mp3 file with different file mime type and content type when uploading
should not be rejected
-----------------------------------------+------------------------------
 Reporter:  soleo                        |       Owner:  (none)
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Media                        |     Version:  5.1
 Severity:  major                        |  Resolution:
 Keywords:  needs-patch has-screenshots  |     Focuses:
-----------------------------------------+------------------------------

Comment (by soleo):

 Thanks for taking care of it.

 I just attached another m4a file (xj.m4a). It was recorded using Vocienote
 app built in SAMSUNG S8.

 Could you explain how you are going to fix it? The fix should work for the
 following types

 - an mp3 file could have a set of mime types such as `audio/mpeg`, `
 video/mp4`
 - similarly, an m4a file could have mime type `audio/mpeg`, `audio/x-m4a`
 or `application/octet-stream`

 This is not a complete list of all variations of possible mime types,
 because every recording app handles it differently. Adding another set of
 mime type for mp3,m4a might solve this current bug, but it is very likely
 that there are other cases we may miss.

 Is there a reason that we have to do mime type checking that strict?

 Replying to [comment:1 subrataemfluence]:
 > Welcome to trac and thanks for the report!
 >
 >
 > {{{
 > recording6021333337014136895.mp3 video/mp4
 > to_test_on_timby_voice_note.m4a application/octet-stream
 > }}}
 >
 >
 > The issue with the above files should ideally be fixed by adding right
 associations in `wp_get_mime_types` function inside
 `wp_includes/functions.php` file.
 >
 >
 > {{{
 > 'mp3'   => 'video/mp4',
 > 'm4a'   => 'application/octet-stream',
 > }}}
 >
 >
 > The issue with `recording6021333337014136895.mp3 video/mp4` has actually
 resolved by the above approach but the `m4a` one is not responding to it!
 >
 > I downloaded few sample `m4a` sample files and they uploaded correctly
 since the mime-types of those are all `audio/x-m4a`, and this is the value
 returned by `get_real_type` function.
 >
 > Although adding a correct association should work (`'m4a' =>
 'application/octet-stream'`) and the `mime-type` of your file is indeed
 `application/octet-stream` I am not sure why it is being rejected!
 However, none of the `m4a` files I downloaded is of `application/octet-
 stream`.
 >
 > Can you send another `m4a` of `application/octet-stream` type file for
 further testing please?

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


More information about the wp-trac mailing list