WordPress.org

Make WordPress Core

Ticket #37989: 37989.diff

File 37989.diff, 702 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..b64c443 100644
    function media_handle_upload($file_id, $post_id, $post_data = array(), $override 
    285285                return new WP_Error( 'upload_error', $file['error'] );
    286286
    287287        $basename = pathinfo( $name, PATHINFO_BASENAME );
     288        $ext = pathinfo( $name, PATHINFO_EXTENSION );
     289
     290        $name = trim( substr( $basename, 0, - ( 1 + strlen( $ext ) ) ) );
    288291
    289292        $url = $file['url'];
    290293        $type = $file['type'];
    291294        $file = $file['file'];
    292         $title = sanitize_title( $basename );
     295        $title = sanitize_text_field( $name );
    293296        $content = '';
    294297        $excerpt = '';
    295298