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
This commit is contained in:
Scott Taylor 2015-01-04 02:51:20 +00:00
parent 621e909a9b
commit 14ddc6c9c0

View File

@ -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 );