Make WordPress Core

Opened 20 years ago

Closed 20 years ago

#2068 closed defect (bug) (fixed)

inline-uploading leaves thumbnail on disk even after deleting original image

Reported by: itdamager's profile itdamager Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.0
Component: Administration Keywords:
Focuses: Cc:

Description

This seems to fix it. I see no reason to run an is_file() to check for its existence since unlink errors are suppressed.

Index: wp-includes/functions-post.php
===================================================================
--- wp-includes/functions-post.php	(revision 3294)
+++ wp-includes/functions-post.php	(working copy)
@@ -357,8 +357,11 @@
 	if ( ! empty($meta['file']) )
 		@ unlink($meta['file']);
 
-	if ( ! empty($file) )
+	if ( ! empty($file) ) {
 		@ unlink($file);
+		$pathparts = pathinfo($file);
+		@ unlink($pathparts['dirname']."/thumb-".$pathparts['basename']);
+	}
 
 	do_action('delete_attachment', $postid);
 

Change History (1)

#1 @skeltoac
20 years ago

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

(In [3303]) Thumbnails are now deleted unless the "still in use" query returns anything.

Note: See TracTickets for help on using tickets.