Skip to content

Commit

Permalink
Escape the output in wp_ajax_upload_attachment().
Browse files Browse the repository at this point in the history
Props whyisjake, sstoqnov.

git-svn-id: https://develop.svn.wordpress.org/trunk@45936 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Sep 4, 2019
1 parent 7f033de commit a04e391
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/wp-admin/async-upload.php
Expand Up @@ -22,7 +22,7 @@

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' );
Expand Down
8 changes: 4 additions & 4 deletions src/wp-admin/includes/ajax-actions.php
Expand Up @@ -2508,7 +2508,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'] ),
),
)
);
Expand All @@ -2525,7 +2525,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'] ),
),
)
);
Expand All @@ -2552,7 +2552,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'] ),
),
)
);
Expand All @@ -2569,7 +2569,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'] ),
),
)
);
Expand Down

0 comments on commit a04e391

Please sign in to comment.