Opened 4 years ago
Last modified 4 years ago
#54193 new defect (bug)
PHP fileinfo extention identifies JSON as text/plain; wp_check_filetype_and_ext then prevents upload
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Media | Keywords: | has-patch needs-refresh |
| Focuses: | Cc: |
Description
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.
Attachments (2)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Hi there! thanks for the ticket and patch.
Your patch fileinfo-json-fix.diff removed
application/jsonfrom the file.Here are a couple of resources to help you get started creating and submitting a patch:
For creating the patch
masterbranch (the images show you are on the 5.8 branch)masterto the upstreamwordpress/wordpress-developrepo, i.e. by pulling the latest changes from upstream and then merging these changes into your local copysvn diff > 54193.diffto create the patch file