Make WordPress Core

Opened 12 years ago

Closed 10 years ago

#22949 closed enhancement (wontfix)

More Accurate and Extensible MIME Type Handling

Reported by: mattonomics's profile mattonomics Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords: has-patch
Focuses: Cc:

Description

In the general case, a file extension may represent more than one MIME type. Currently, file extensions are married to a single MIME.

Specifically, let's look at the case of the "ico" file extension. Officially, the MIME type for this file should be "image/vnd.microsoft.icon". Unofficially, "image/x-icon" along with many others are usable.

The solution to this problem is extremely simple.

First, allow key => value pairs in the exhaustive MIME list located in wp_get_mime_types to be arrays so we can account for cases such as ico.

Second, add the proper handling for this change in wp_check_filetype. The way I have written it should not interfere with existing uses of this function (as they were all passing strings and now can pass a string or array).

Attachments (3)

functions.php.patch (2.0 KB) - added by mattonomics 12 years ago.
favicon.ico (1.1 KB) - added by mattonomics 12 years ago.
class-wp-image-editor.php.patch (1012 bytes) - added by mattonomics 12 years ago.

Download all attachments as: .zip

Change History (7)

#2 @SergeyBiryukov
12 years ago

  • Version changed from trunk to 3.5

@mattonomics
12 years ago

#3 @mattonomics
12 years ago

To really see the MIME issue in action, upload the favicon I've attached to this ticket while in multisite. Be sure to add ico to the list of accepted extensions!

#4 @wonderboymusic
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Just closed #11824, we shouldn't bend over backwards just to support multiple mimes for favicons

Note: See TracTickets for help on using tickets.