Make WordPress Core

Opened 12 years ago

Closed 8 years ago

#17812 closed defect (bug) (fixed)

media_upload_form_handler runs twice when editing attachment from "From Computer" media upload tab (browser uploader)

Reported by: jeffstieler's profile jeffstieler Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.1
Component: Upload Keywords: has-patch needs-testing
Focuses: Cc:

Description

After uploading a new media item "From Computer" using the browser uploader, you are presented with a form to edit its fields.

Clicking "Save all changes" from this form causes media_upload_form_handler to run, then media_upload_gallery (presumably to redirect to the gallery tab), which then causes media_upload_form_handler to run again.

This can cause problems for edit_attachment actions that only run once and alter the posts table row for that attachment (since the subsequent media_upload_form_handler could overwrite whatever changes were made in the action if they don't match whats in $_POST).

If the only reason media_upload_gallery is being called from the other type upload handler is to redirect to the gallery tab.. perhaps this patch is a better approach.

Attachments (2)

media.php.r18313.diff (1.4 KB) - added by jeffstieler 12 years ago.
17812-2.diff (518 bytes) - added by antpb 8 years ago.

Download all attachments as: .zip

Change History (8)

#1 @coffee2code
11 years ago

  • Keywords needs-refresh added
  • Version set to 3.1.3

Patch no longer applies cleanly against trunk as of r21435.

#2 @chriscct7
8 years ago

  • Version changed from 3.1.3 to 3.1

#3 @antpb
8 years ago

  • Keywords needs-testing added; needs-refresh removed

Looks like there is only one instance of this now that needs the change. Patch refreshed below.

@antpb
8 years ago

#4 @chriscct7
8 years ago

  • Milestone changed from Awaiting Review to 4.4
  • Owner set to chriscct7
  • Status changed from new to reviewing

#5 @wonderboymusic
8 years ago

  • Owner changed from chriscct7 to wonderboymusic
  • Status changed from reviewing to accepted

#6 @wonderboymusic
8 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 34003:

In wp_media_upload_handler(), replace a lingering instance of media_upload_gallery() with wp_iframe(...)

Props jeffstieler, antpb.
Fixes #17812.

Note: See TracTickets for help on using tickets.