[wp-trac] [WordPress Trac] #33227: "Delete Permantently" Only Deletes Original Size (UTF-8 file names) (was: Image sizes with diacritic in filename not deleted)

WordPress Trac noreply at wordpress.org
Sun Jan 17 04:28:25 UTC 2016


#33227: "Delete Permantently" Only Deletes Original Size (UTF-8 file names)
--------------------------+-----------------------------
 Reporter:  pavelevap     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Media         |     Version:  4.4.1
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------------
Changes (by Pamela1991):

 * version:   => 4.4.1


Comment:

 This is actually not a problem with diacritics; rather, it is an issue
 with UTF-8 file names.

 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.

 I tried modifying wp_delete_attachment() in post.php by changing the
 following lines to no avail:
 {{{#!php
 <?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 );
 }}}

 I'm not sure what else to try, but if someone can point me in the right
 direction as to what files or functions I need to play with, that would be
 excellent.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33227#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list