[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
Fri Jan 27 02:33:41 UTC 2023


#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 has-     |     Focuses:
  testing-info                                   |
-------------------------------------------------+-------------------------
Changes (by ironprogrammer):

 * keywords:  needs-patch has-screenshots => needs-patch has-screenshots
     has-testing-info


Comment:

 == Reproduction Report
 I'm providing an updated test report to confirm this issue still exists.

 === Steps to Reproduce
 1. In your test WordPress site, navigate to Media.
 2. Attempt to upload an audio file that has a MIME type of `video/mp4`
 (e.g.
 [https://core.trac.wordpress.org/attachment/ticket/57530/Monday%20at%202-57%20AM.m4a
 Monday%20at%202-57%20AM.m4a]).
 3. 🐞 The uploader responds with the error: "Sorry, you are not allowed to
 upload this file type."

 === Environment
 - Hardware: MacBook Pro Apple M1 Pro
 - OS: macOS 12.6.2
 - Browser: Safari 16.2
 - Server: nginx/1.23.3
 - PHP: 7.4.33
 - WordPress: 6.2-alpha-54642-src

 === Expected Results
 - ✅ The uploader should allow audio files with a MIME type of
 `video/mp4`, which is common for Android.

 === Actual Results
 - ❌ The uploader does not allow upload of an audio file with MIME type
 `video/mp4` and responds with an error. This occurred for a sample `.mp3`
 and `.m4a` file.

 === Additional Notes
 When using macOS Safari, `.m4a` files may be converted to `.mp3` when
 using Trac's attachment download link. However, this does not change the
 MIME type, so the resultant converted `.mp3` file should still validate
 the error. To avoid ambiguity,  when downloading contributor-supplied
 samples, I recommend using a different browser, or `curl -O <url-to-file>`
 instead.

 The sample audio file's MIME type was verified using (includes Safari's
 `.mp3` conversion):
 {{{
 $ file -I Monday\ at\ 2-57\ AM*
 Monday at 2-57 AM.m4a:     video/mp4; charset=binary
 Monday at 2-57 AM.m4a.mp3: video/mp4; charset=binary
 }}}

 A sample iOS-generated `.m4a` was verified using:
 {{{
 $ file -I iPhone-sample.m4a
 iPhone-sample.m4a: audio/x-m4a; charset=binary
 }}}

 === Supplemental Artifacts
 The
 [https://core.trac.wordpress.org/attachment/ticket/57530/Monday%20at%202-57%20AM.m4a
 sample Android recorder audio file] was supplied by @pontifier in #57530.

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


More information about the wp-trac mailing list