[wp-trac] [WordPress Trac] #54193: PHP fileinfo extention identifies JSON as text/plain; wp_check_filetype_and_ext then prevents upload

WordPress Trac noreply at wordpress.org
Mon Sep 27 16:54:56 UTC 2021


#54193: PHP fileinfo extention identifies JSON as text/plain;
wp_check_filetype_and_ext then prevents upload
--------------------------+-----------------------------
 Reporter:  dashifen      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  5.8.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 For hosts that make available the PHP fileinfo extension, uploaded files
 of mime type `application/json` are identified by that extension as
 `text/plain`.  Within the `wp_check_filetype_and_ext` function, it's noted
 that "a few common file types are occasionally detected as `text/plain`",
 but `application/json` is not listed as one of those common types.  For
 reference, the following types are listed:  csv, rtf, tsv, and vtt.

 I propose adding `application/json` to this list.  Otherwise, I believe it
 may be impossible to upload a JSON file on a host that uses this
 extension.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54193>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list