WordPress.org

Make WordPress Core

Ticket #24716: 24716.13.diff

File 24716.13.diff, 891 bytes (added by kovshenin, 4 years ago)
  • src/wp-includes/media.php

     
    26312631                $response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __( '(No title)' );
    26322632        }
    26332633
    2634         $bytes = filesize( get_attached_file( $attachment->ID ) );
    2635         $response['filesizeInBytes'] = $bytes;
    2636         $response['filesizeHumanReadable'] = size_format( $bytes );
     2634        $attached_file = get_attached_file( $attachment->ID );
     2635        if ( file_exists( $attached_file ) ) {
     2636                $bytes = filesize( $attached_file );
     2637                $response['filesizeInBytes'] = $bytes;
     2638                $response['filesizeHumanReadable'] = size_format( $bytes );
     2639        }
    26372640
    26382641        if ( current_user_can( 'edit_post', $attachment->ID ) ) {
    26392642                $response['nonces']['update'] = wp_create_nonce( 'update-post_' . $attachment->ID );