Make WordPress Core

Changeset 45936


Ignore:
Timestamp:
09/04/2019 04:08:03 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Escape the output in wp_ajax_upload_attachment().

Props whyisjake, sstoqnov.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/async-upload.php

    r45926 r45936  
    2323require_once( ABSPATH . 'wp-admin/admin.php' );
    2424
    25 header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
     25header( 'Content-Type: text/plain; charset=' . get_option( 'blog_charset' ) );
    2626
    2727if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
  • trunk/src/wp-admin/includes/ajax-actions.php

    r45934 r45936  
    25092509                'data'    => array(
    25102510                    'message'  => __( 'Sorry, you are not allowed to upload files.' ),
    2511                     'filename' => $_FILES['async-upload']['name'],
     2511                    'filename' => esc_html( $_FILES['async-upload']['name'] ),
    25122512                ),
    25132513            )
     
    25262526                    'data'    => array(
    25272527                        'message'  => __( 'Sorry, you are not allowed to attach files to this post.' ),
    2528                         'filename' => $_FILES['async-upload']['name'],
     2528                        'filename' => esc_html( $_FILES['async-upload']['name'] ),
    25292529                    ),
    25302530                )
     
    25532553                    'data'    => array(
    25542554                        'message'  => __( 'The uploaded file is not a valid image. Please try again.' ),
    2555                         'filename' => $_FILES['async-upload']['name'],
     2555                        'filename' => esc_html( $_FILES['async-upload']['name'] ),
    25562556                    ),
    25572557                )
     
    25702570                'data'    => array(
    25712571                    'message'  => $attachment_id->get_error_message(),
    2572                     'filename' => $_FILES['async-upload']['name'],
     2572                    'filename' => esc_html( $_FILES['async-upload']['name'] ),
    25732573                ),
    25742574            )
Note: See TracChangeset for help on using the changeset viewer.