From 14ddc6c9c0a01ac5fead70e40bb916394b6cc40e Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sun, 4 Jan 2015 02:51:20 +0000 Subject: [PATCH] If `IMAGE_EDIT_OVERWRITE` is defined as `true`, ensure that multiple edits to the same image does not result in the file being deleted (updating the meta fails because the old and new paths are identical). Props hew. Fixes #30394. git-svn-id: https://develop.svn.wordpress.org/trunk@31043 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/image-edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/image-edit.php b/src/wp-admin/includes/image-edit.php index 7e3e7f7e2d..cdb1cf8e98 100644 --- a/src/wp-admin/includes/image-edit.php +++ b/src/wp-admin/includes/image-edit.php @@ -748,7 +748,7 @@ function wp_save_image( $post_id ) { if ( $tag ) $backup_sizes[$tag] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $path_parts['basename']); - $success = update_attached_file( $post_id, $new_path ); + $success = ( $path === $new_path ) || update_attached_file( $post_id, $new_path ); $meta['file'] = _wp_relative_upload_path( $new_path );