Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#20666 closed defect (bug) (fixed)

Custom header image cropping can create identical attachments

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: ryan's profile ryan
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.4
Component: Customize Keywords: has-patch
Focuses: Cc:

Description

  1. Add an image to Media Library which requires cropping.
  2. Go to Appearance → Header, click "Choose from image library".
  3. Select the image from point 1, click "Set as header", "Crop and Publish".
  4. Press browser's Back button, click "Crop and Publish" once again.
  5. Delete one of the two identical "Header Image" attachments in Media Library.
  6. The other attachment is now orphaned (the files are deleted in point 5).

Sounds like wp_unique_filename() should be used in there somewhere.

Related: #19840, #20657

Attachments (2)

20666.patch (583 bytes) - added by SergeyBiryukov 13 years ago.
20666.2.patch (591 bytes) - added by SergeyBiryukov 13 years ago.

Download all attachments as: .zip

Change History (7)

#1 @SergeyBiryukov
13 years ago

  • Keywords has-patch added; needs-patch removed

#2 follow-up: @ryan
13 years ago

Perhaps we should also call wp_upload_dir() to get a newly dated upload dir instead of reusing the old dir when cropping an existing image from the media library.

#3 @SergeyBiryukov
13 years ago

20666.2.patch fixes the line placement (should be after wp_mkdir_p()).

#4 in reply to: ↑ 2 @SergeyBiryukov
13 years ago

Replying to ryan:

Perhaps we should also call wp_upload_dir() to get a newly dated upload dir instead of reusing the old dir when cropping an existing image from the media library.

step_3() in wp-admin/custom-header.php would still expect the new attachment to be in the same directory as the original file:
http://core.trac.wordpress.org/browser/trunk/wp-admin/custom-header.php?rev=20769#L877

Last edited 13 years ago by SergeyBiryukov (previous) (diff)

#5 @ryan
13 years ago

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

In [20787]:

Make the file names unique for cropped header images. Props SergeyBiryukov. fixes #20666

Note: See TracTickets for help on using tickets.