Make WordPress Core

Opened 14 years ago

Closed 12 years ago

#17117 closed defect (bug) (fixed)

WordPress serves up wrong MIME type for Office 2007 downloads

Reported by: lafayettenuke's profile LafayetteNuke Owned by: ryan's profile ryan
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.1
Component: Media Keywords: has-patch commit
Focuses: Cc:

Description

When serving up hosted files for download, WordPress assigns the wrong MIME type for Office 2007. For example, docx files are served up as "application/msword" instead of "application/vnd.openxmlformats-officedocument.wordprocessingml.document"

As a result, browsers end up interpreting the files in different ways. Some, like IE8 on Windows 7 or Safari on Mac OS X 10.6, will add a ".doc" to the end of the file name. Others (Firefox, Chrome) will see the Office 98-2003 MIME type, but keep the existing file name. The iPad displays a "Unknown file type" error. The issue is not limited to Word 2007 files however; all Office 2007 files (pptx, xlsx) appear to have the same issue.

There is a forum discussion for this issue:
http://wordpress.org/support/topic/docx-files-and-functionsphp?replies=9

It's possible this bug was introduced here:
http://core.trac.wordpress.org/changeset/9662

The proposed change is to tweak the MIME declarations in wp-includes/functions.php to reflect the proper MIME type information.

Attachments (5)

17117-1.patch (886 bytes) - added by hebbet 14 years ago.
with correct name
17117-2.patch (868 bytes) - added by hebbet 14 years ago.
mime.patch (2.7 KB) - added by mohanjith 13 years ago.
Based on /etc/mime.types from Ubuntu 11.04
17117.2.patch (3.5 KB) - added by SergeyBiryukov 13 years ago.
17117.3.patch (6.3 KB) - added by SergeyBiryukov 12 years ago.

Download all attachments as: .zip

Change History (18)

#1 @solarissmoke
14 years ago

  • Keywords has-patch added

#2 @dd32
14 years ago

Patch looks valid, however, it'd be appreciated if when creating patches, you either use svn diff, or include the full filename in the path of the diff.

This should only be affecting Multisite, as only multisite installs serve files through the File handler (Single sites serve static files directly, and any mime type issues are a server configuration issue)

@hebbet
14 years ago

with correct name

#3 @hebbet
14 years ago

@dd32
added updated version (hopefully with correct naming). sorry didn't noticed that the name wasn't included.

@hebbet
14 years ago

#4 @mohanjith
13 years ago

  • Cc mohanjith added

Any plans to apply the patch?

@mohanjith
13 years ago

Based on /etc/mime.types from Ubuntu 11.04

#5 @nacin
13 years ago

  • Milestone changed from Awaiting Review to 3.4

mime.patch looks sane.

#6 @SergeyBiryukov
13 years ago

  • Keywords commit added

#7 follow-up: @nacin
13 years ago

I see 'sld' added in wp_ext2type() but missing from get_allowed_mime_types().

#8 in reply to: ↑ 7 @SergeyBiryukov
13 years ago

Replying to nacin:

I see 'sld' added in wp_ext2type() but missing from get_allowed_mime_types().

I guess it should be 'sldm'. Fixed in 17117.2.patch. Whitespace changes are for better alignment.

#9 @ryan
13 years ago

  • Milestone changed from 3.4 to Future Release

#10 @SergeyBiryukov
13 years ago

Related/duplicate: #15735

#11 @SergeyBiryukov
12 years ago

Merged with the patch from #15735 (some rearragements and comments for easier reading).

#12 @SergeyBiryukov
12 years ago

  • Component changed from Filesystem to Media
  • Milestone changed from Future Release to 3.5

#13 @ryan
12 years ago

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

In [21527]:

Fix MS Office mime types. Group the mime list in get_allowed_mime_types() by type. Props hebbet, markel, SergeyBiryukov. fixes #17117

Note: See TracTickets for help on using tickets.