WordPress.org

Make WordPress Core

Changeset 45939


Ignore:
Timestamp:
09/04/2019 04:17:53 PM (2 weeks ago)
Author:
SergeyBiryukov
Message:

Escape the output in wp_ajax_upload_attachment().

Merges [45936] to the 5.1 branch.
Props whyisjake, sstoqnov.

Location:
branches/5.1
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/5.1

  • branches/5.1/src/wp-admin/async-upload.php

    r44331 r45939  
    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'] ) {
  • branches/5.1/src/wp-admin/includes/ajax-actions.php

    r44985 r45939  
    23042304                'data'    => array(
    23052305                    'message'  => __( 'Sorry, you are not allowed to upload files.' ),
    2306                     'filename' => $_FILES['async-upload']['name'],
     2306                    'filename' => esc_html( $_FILES['async-upload']['name'] ),
    23072307                ),
    23082308            )
     
    23202320                    'data'    => array(
    23212321                        'message'  => __( 'Sorry, you are not allowed to attach files to this post.' ),
    2322                         'filename' => $_FILES['async-upload']['name'],
     2322                        'filename' => esc_html( $_FILES['async-upload']['name'] ),
    23232323                    ),
    23242324                )
     
    23462346                    'data'    => array(
    23472347                        'message'  => __( 'The uploaded file is not a valid image. Please try again.' ),
    2348                         'filename' => $_FILES['async-upload']['name'],
     2348                        'filename' => esc_html( $_FILES['async-upload']['name'] ),
    23492349                    ),
    23502350                )
     
    23632363                'data'    => array(
    23642364                    'message'  => $attachment_id->get_error_message(),
    2365                     'filename' => $_FILES['async-upload']['name'],
     2365                    'filename' => esc_html( $_FILES['async-upload']['name'] ),
    23662366                ),
    23672367            )
Note: See TracChangeset for help on using the changeset viewer.