From 6cded9493aa709b1d82e8d4633023ac9ca6d2bf1 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 23 Jun 2015 18:29:44 +0000 Subject: [PATCH] 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 --- src/wp-includes/media.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index c232d8e6a3..d10b5a5462 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -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 ),