WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#33012 closed defect (bug) (fixed)

Full MIME type parameter ignored in wp_mime_type_icon() and 'default' used instead.

Reported by: morganestes Owned by: wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.2.2
Component: Media Keywords: has-patch
Focuses: Cc:

Description

When passing a MIME type of 'video/mp4' to wp_mime_type_icon(), the URI gets set to http://example.com/wp-includes/images/media/video.png as expected, but the check for isset($types[$wilds[0]]) fails to match the MIME type and matches on 'default' instead since it's looking for 'video' but $wilds[0] is 'video/mp4'.

A workaround for this is to only pass 'video' as the parameter to force the check to match the media filename, but that's checking for filename match, not MIME matches.

Attachments (2)

ScreenCapture at Thu Jul 16 02:40:59 CDT 2015.png (78.7 KB) - added by morganestes 6 years ago.
Variable values during the MIME check
33012.diff (1.8 KB) - added by wonderboymusic 6 years ago.

Download all attachments as: .zip

Change History (5)

@morganestes
6 years ago

Variable values during the MIME check

#1 @morganestes
6 years ago

  • Summary changed from Full MIME type ignored in wp_mime_type_icon() for videos to Full MIME type parameter ignored in wp_mime_type_icon() and 'default' used instead.

@wonderboymusic
6 years ago

#2 @wonderboymusic
6 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 34255:

In wp_mime_type_icon(), the length of the $wilds array varies depending on what is passed as $mime. Loop over $wilds instead of arbitrarily checking $wilds[0].

Adds unit tests.

Fixes #33012.

#3 @wonderboymusic
6 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.4
Note: See TracTickets for help on using tickets.