Make WordPress Core

Ticket #30394: patch

File patch, 789 bytes (added by hew, 10 years ago)

Poor man's attempt at a fix

  • wp-includes/post.php

     
    229229         */
    230230        $file = apply_filters( 'update_attached_file', $file, $attachment_id );
    231231
    232         if ( $file = _wp_relative_upload_path( $file ) )
    233                 return update_post_meta( $attachment_id, '_wp_attached_file', $file );
    234         else
     232        $file = _wp_relative_upload_path( $file );
     233
     234        if ( ! $file ) {
    235235                return delete_post_meta( $attachment_id, '_wp_attached_file' );
     236        }
     237
     238        if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE ) {
     239                update_post_meta( $attachment_id, '_wp_attached_file', 'temp' . time() );
     240        }
     241
     242        return update_post_meta( $attachment_id, '_wp_attached_file', $file );
    236243}
    237244
    238245/**