WordPress.org

Make WordPress Core

Ticket #37989: 37989.4.diff

File 37989.4.diff, 678 bytes (added by SergeyBiryukov, 20 months ago)
  • src/wp-admin/includes/media.php

     
    278278                        $time = $post->post_date;
    279279        }
    280280
     281        $name = $_FILES[$file_id]['name'];
    281282        $file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
    282283
    283284        if ( isset($file['error']) )
    284285                return new WP_Error( 'upload_error', $file['error'] );
    285286
    286         $name = pathinfo( $_FILES[$file_id]['name'], PATHINFO_FILENAME );
     287        $ext  = pathinfo( $name, PATHINFO_EXTENSION );
     288        $name = wp_basename( $name, ".$ext" );
    287289
    288290        $url = $file['url'];
    289291        $type = $file['type'];