Media: In `wp_prepare_attachment_for_js()`, don't call `file_exists()` and `filesize()` to retrieve `$bytes` if the data is already present in `$meta`. This is how the same code in `attachment_submitbox_metadata()` already works.

Props polevaultweb.
Fixes #33214.

Built from https://develop.svn.wordpress.org/trunk@34258


git-svn-id: http://core.svn.wordpress.org/trunk@34222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-17 05:03:24 +00:00
parent c871986819
commit ad0eb9c442
2 changed files with 10 additions and 2 deletions

View File

@ -2778,8 +2778,16 @@ function wp_prepare_attachment_for_js( $attachment ) {
}
$attached_file = get_attached_file( $attachment->ID );
if ( file_exists( $attached_file ) ) {
if ( isset( $meta['filesize'] ) ) {
$bytes = $meta['filesize'];
} elseif ( file_exists( $attached_file ) ) {
$bytes = filesize( $attached_file );
} else {
$bytes = '';
}
if ( $bytes ) {
$response['filesizeInBytes'] = $bytes;
$response['filesizeHumanReadable'] = size_format( $bytes );
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34257';
$wp_version = '4.4-alpha-34258';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.