WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#31037 closed defect (bug) (fixed)

Uploading files through media modal causes error in < IE10

Reported by: joehoyle Owned by: dd32
Milestone: 4.1.1 Priority: normal
Severity: normal Version: 4.1
Component: Media Keywords:
Focuses: Cc:
PR Number:

Description (last modified by SergeyBiryukov)

Trying to upload a file in the Media Modal in IE9 and lower triggers a "File Download" popup because the "async-upload.php" endpoint now returns Content-Type: application/json since 4.1. IE9 and lower don't understand this content-type so trigger a file download dialogue.

This was discussed at some length with the introduction of the new Media Modal here: https://core.trac.wordpress.org/ticket/22446#comment:20 long story short - returning application/json is not usually a problem as jQuery automatically handles it for older versions of IE, however this particular request is handled by Plupload which does not handle this edge case.

Before [30354] this endpoint returned text/html as it's Content Type; however now wp_send_json_error and associated functions are used which triggers a Content-Type header of application/json.

I'm not sure what versions of IE is "officially" supported, but it would seem right now the upload file workflow feels broken in < IE10.

Attachments (2)

31037.diff (6.1 KB) - added by dd32 5 years ago.
31037.411.diff (3.9 KB) - added by dd32 5 years ago.

Download all attachments as: .zip

Change History (10)

This ticket was mentioned in Slack in #core by joehoyle. View the logs.


5 years ago

#2 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 4.1.1

#3 @SergeyBiryukov
5 years ago

  • Description modified (diff)

This ticket was mentioned in Slack in #core by dd32. View the logs.


5 years ago

@dd32
5 years ago

#5 @dd32
5 years ago

As @pento pointed out - r22845 from the linked thread above.

For 4.1.1, I think we should just revert those changes to admin-ajax.php made in [30354].

31037.diff implements an (untested) alternative for 4.2, simply add a $content_type parameter, so we're explicit in what we're sending so this doesn't happen again.. I'm not entirely sure I like the parameter, but since it's needed for older browsers, doesn't seem too horrible.

This ticket was mentioned in Slack in #core by dd32. View the logs.


5 years ago

@dd32
5 years ago

#7 @dd32
5 years ago

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

In 31429:

Prevent IE9 and lower displaying the download file dialogue when attempting to upload using the html4 Plupload handler.

The HTML4 Plupload handler uses a hidden iframe to POST the upload form,
Unfortunately Internet Explorer 9 doesn't support the application/json
content-type which wp_send_json_success() and requires text/html instead.

This partially reverts [30354], keeping the better error messages.

Fixes #31037 for trunk.

#8 @dd32
5 years ago

In 31430:

Prevent IE9 and lower displaying the download file dialogue when attempting
to upload using the html4 Plupload handler.

The HTML4 Plupload handler uses a hidden iframe to POST the upload form, and
unfortunately Internet Explorer 9 doesn't support the application/json
content-type which wp_send_json_success() and requires text/html instead.

This partially reverts [30354], keeping the better error messages.

Merges [31429] to the 4.1 branch.
Fixes #31037.

Note: See TracTickets for help on using tickets.