Escape the output in wp_ajax_upload_attachment()
.
Merges [45936] to the 5.1 branch. Props whyisjake, sstoqnov. git-svn-id: https://develop.svn.wordpress.org/branches/5.1@45939 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
eaa0d5b92b
commit
bf34d826e8
@ -22,7 +22,7 @@ if ( defined( 'ABSPATH' ) ) {
|
||||
|
||||
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' );
|
||||
|
@ -2303,7 +2303,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'] ),
|
||||
),
|
||||
)
|
||||
);
|
||||
@ -2319,7 +2319,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'] ),
|
||||
),
|
||||
)
|
||||
);
|
||||
@ -2345,7 +2345,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'] ),
|
||||
),
|
||||
)
|
||||
);
|
||||
@ -2362,7 +2362,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'] ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user