WordPress.org

Make WordPress Core

Ticket #37989: 37989.2.diff

File 37989.2.diff, 663 bytes (added by joemcgill, 21 months ago)
  • src/wp-admin/includes/media.php

    diff --git src/wp-admin/includes/media.php src/wp-admin/includes/media.php
    index 35aa791..3d89758 100644
    function media_handle_upload($file_id, $post_id, $post_data = array(), $override 
    284284        if ( isset($file['error']) )
    285285                return new WP_Error( 'upload_error', $file['error'] );
    286286
    287         $basename = pathinfo( $name, PATHINFO_BASENAME );
     287        $name = pathinfo( $name, PATHINFO_FILENAME );
    288288
    289289        $url = $file['url'];
    290290        $type = $file['type'];
    291291        $file = $file['file'];
    292         $title = sanitize_title( $basename );
     292        $title = sanitize_text_field( $name );
    293293        $content = '';
    294294        $excerpt = '';
    295295