Escape the output in wp_ajax_upload_attachment().

Merges [45936] to the 4.8 branch.
Props whyisjake, sstoqnov.
Built from https://develop.svn.wordpress.org/branches/4.8@45944


git-svn-id: http://core.svn.wordpress.org/branches/4.8@45755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-09-04 16:31:23 +00:00
parent b3a9479bd3
commit 33f4539c6e
2 changed files with 5 additions and 5 deletions

View File

@ -32,7 +32,7 @@ if ( ! ( isset( $_REQUEST['action'] ) && 'upload-attachment' == $_REQUEST['actio
require_once( ABSPATH . 'wp-admin/admin.php' );
header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
header( 'Content-Type: text/plain; charset=' . get_option( 'blog_charset' ) );
if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
include( ABSPATH . 'wp-admin/includes/ajax-actions.php' );

View File

@ -2065,7 +2065,7 @@ function wp_ajax_upload_attachment() {
'success' => false,
'data' => array(
'message' => __( 'Sorry, you are not allowed to upload files.' ),
'filename' => $_FILES['async-upload']['name'],
'filename' => esc_html( $_FILES['async-upload']['name'] ),
)
) );
@ -2079,7 +2079,7 @@ function wp_ajax_upload_attachment() {
'success' => false,
'data' => array(
'message' => __( 'Sorry, you are not allowed to attach files to this post.' ),
'filename' => $_FILES['async-upload']['name'],
'filename' => esc_html( $_FILES['async-upload']['name'] ),
)
) );
@ -2103,7 +2103,7 @@ function wp_ajax_upload_attachment() {
'success' => false,
'data' => array(
'message' => __( 'The uploaded file is not a valid image. Please try again.' ),
'filename' => $_FILES['async-upload']['name'],
'filename' => esc_html( $_FILES['async-upload']['name'] ),
)
) );
@ -2118,7 +2118,7 @@ function wp_ajax_upload_attachment() {
'success' => false,
'data' => array(
'message' => $attachment_id->get_error_message(),
'filename' => $_FILES['async-upload']['name'],
'filename' => esc_html( $_FILES['async-upload']['name'] ),
)
) );