From cdaa82bc9b37829d5b23a1cb82ee59c6a5f0ee47 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 8 Jul 2013 13:55:50 +0000 Subject: [PATCH] Use wp_basename() in newer media code for filenames to avoid encoding issues on display. props SergeyBiryukov, fixes #23267. git-svn-id: https://develop.svn.wordpress.org/trunk@24585 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/media.php | 2 +- wp-includes/media.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 2977bdff13..54e2eb7e93 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -2423,7 +2423,7 @@ function edit_form_image_editor( $post ) { function attachment_submitbox_metadata() { $post = get_post(); - $filename = esc_html( basename( $post->guid ) ); + $filename = esc_html( wp_basename( $post->guid ) ); $media_dims = ''; $meta = wp_get_attachment_metadata( $post->ID ); diff --git a/wp-includes/media.php b/wp-includes/media.php index 48e1fb5f55..5b5501a158 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1606,7 +1606,7 @@ function wp_prepare_attachment_for_js( $attachment ) { $response = array( 'id' => $attachment->ID, 'title' => $attachment->post_title, - 'filename' => basename( $attachment->guid ), + 'filename' => wp_basename( $attachment->guid ), 'url' => $attachment_url, 'link' => get_attachment_link( $attachment->ID ), 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),