In wp_prepare_attachment_for_js(), when setting filename, call wp_basename() on the result of get_attached_file(), not WP_Post->guid. guid can be set to the result get_permalink(), which is not a file path.

Props daxelrod.
Fixes #32531.


git-svn-id: https://develop.svn.wordpress.org/trunk@32914 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-06-23 18:29:44 +00:00
parent 5beca90d40
commit 6cded9493a

View File

@ -2720,7 +2720,7 @@ function wp_prepare_attachment_for_js( $attachment ) {
$response = array(
'id' => $attachment->ID,
'title' => $attachment->post_title,
'filename' => wp_basename( $attachment->guid ),
'filename' => wp_basename( get_attached_file( $attachment->ID ) ),
'url' => $attachment_url,
'link' => get_attachment_link( $attachment->ID ),
'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),