Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#35485 closed defect (bug) (duplicate)

"Delete Permantently" Only Deletes Original Size (UTF-8 file names)

Reported by: pamela1991's profile Pamela1991 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4.1
Component: Media Keywords: needs-patch
Focuses: Cc:

Description

When deleting uploaded media files with UTF-8 file names, upon permanently deleting these files, only the original full size image is deleted, whereas all re-sized variants are not deleted.

Steps to reproduce this issue:

  1. Upload New Media file titled صورة.jpg via http://domain.com/wp-admin/media-new.php
  2. Delete Permanently from Media Library
  3. Navigate to FTP directory and only the original full-size picture will have been deleted. All re-sized versions remain.

There is a similar ticket, but it is incorrectly titled/described as being an issue with diacritics in filename. However, this is a UTF-8 problem.

I tried modifying wp_delete_attachment() in post.php by changing the following lines to no avail:

<?php
4703     $meta = utf8_encode(wp_get_attachment_metadata( $post_id ));
4704     $backup_sizes = utf8_encode(get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true ));
4752     $thumbfile = mb_ereg_replace(basename($file), $meta['thumb'], $file);
4762     $intermediate_file = mb_ereg_replace( basename( $file ), $sizeinfo['file'], $file );

Change History (2)

#1 @Pamela1991
9 years ago

  • Keywords needs-patch added

#2 @swissspidy
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hey there, tanks for creating this ticket!

Since it's basically the same issue as in #33227 we should combine efforts there.

Note: See TracTickets for help on using tickets.