Escape the output in `wp_ajax_upload_attachment()`.

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


git-svn-id: http://core.svn.wordpress.org/branches/3.9@45777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-09-04 16:48:23 +00:00
parent 2dd32a25ce
commit e1a05244d9
2 changed files with 3 additions and 3 deletions

View File

@ -32,7 +32,7 @@ require_once( ABSPATH . 'wp-admin/includes/admin.php' );
/** Load Ajax Handlers for WordPress Core */
require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
@header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
@header( 'Content-Type: text/plain; charset=' . get_option( 'blog_charset' ) );
@header( 'X-Robots-Tag: noindex' );
send_nosniff_header();

View File

@ -1620,7 +1620,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'] ),
)
) );
@ -1635,7 +1635,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'] ),
)
) );