Make sure the attachment file exists before calling filesize() on it. props DrewAPicture. fixes #25170.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2013-09-24 20:23:10 +00:00
parent 9dcd0110fb
commit 9d5c2eb55f
1 changed files with 5 additions and 2 deletions

View File

@ -2451,10 +2451,13 @@ function attachment_submitbox_metadata() {
</div>
<?php
$file = get_attached_file( $post->ID );
$file_size = false;
if ( isset( $meta['filesize'] ) )
$file_size = $meta['filesize'];
else
$file_size = filesize( get_attached_file( $post->ID ) );
elseif ( file_exists( $file ) )
$file_size = filesize( $file );
if ( ! empty( $file_size ) ) : ?>
<div class="misc-pub-section misc-pub-filesize">