Opened 13 months ago
Closed 13 months ago
#20666 closed defect (bug) (fixed)
Custom header image cropping can create identical attachments
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | Appearance | Version: | 3.4 |
| Severity: | normal | Keywords: | has-patch |
| Cc: |
Description
- Add an image to Media Library which requires cropping.
- Go to Appearance → Header, click "Choose from image library".
- Select the image from point 1, click "Set as header", "Crop and Publish".
- Press browser's Back button, click "Crop and Publish" once again.
- Delete one of the two identical "Header Image" attachments in Media Library.
- The other attachment is now orphaned (the files are deleted in point 5).
Sounds like wp_unique_filename() should be used in there somewhere.
Attachments (2)
Change History (7)
SergeyBiryukov — 13 months ago
comment:1
SergeyBiryukov — 13 months ago
- Keywords has-patch added; needs-patch removed
SergeyBiryukov — 13 months ago
comment:3
SergeyBiryukov — 13 months ago
20666.2.patch fixes the line placement (should be after wp_mkdir_p()).
comment:4
in reply to:
↑ 2
SergeyBiryukov — 13 months 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
Note: See
TracTickets for help on using
tickets.

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.