WordPress.org

Make WordPress Core

Changeset 45944


Ignore:
Timestamp:
09/04/2019 04:30:11 PM (13 months ago)
Author:
SergeyBiryukov
Message:

Escape the output in wp_ajax_upload_attachment().

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

Location:
branches/4.8
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.8

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

    r39756 r45944  
    3333require_once( ABSPATH . 'wp-admin/admin.php' );
    3434
    35 header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
     35header( 'Content-Type: text/plain; charset=' . get_option( 'blog_charset' ) );
    3636
    3737if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
  • branches/4.8/src/wp-admin/includes/ajax-actions.php

    r44846 r45944  
    20662066            'data'    => array(
    20672067                'message'  => __( 'Sorry, you are not allowed to upload files.' ),
    2068                 'filename' => $_FILES['async-upload']['name'],
     2068                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    20692069            )
    20702070        ) );
     
    20802080                'data'    => array(
    20812081                    'message'  => __( 'Sorry, you are not allowed to attach files to this post.' ),
    2082                     'filename' => $_FILES['async-upload']['name'],
     2082                    'filename' => esc_html( $_FILES['async-upload']['name'] ),
    20832083                )
    20842084            ) );
     
    21042104                'data'    => array(
    21052105                    'message'  => __( 'The uploaded file is not a valid image. Please try again.' ),
    2106                     'filename' => $_FILES['async-upload']['name'],
     2106                    'filename' => esc_html( $_FILES['async-upload']['name'] ),
    21072107                )
    21082108            ) );
     
    21192119            'data'    => array(
    21202120                'message'  => $attachment_id->get_error_message(),
    2121                 'filename' => $_FILES['async-upload']['name'],
     2121                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    21222122            )
    21232123        ) );
Note: See TracChangeset for help on using the changeset viewer.