WordPress.org

Make WordPress Core

Ticket #6813: press-this-sideload-querystringfix.diff

File press-this-sideload-querystringfix.diff, 627 bytes (added by noel, 7 years ago)

Query String fix for file.php

  • includes/file.php

     
    285285                return $upload_error_handler( $file, $uploads['error'] ); 
    286286 
    287287        $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); 
    288  
     288         
     289        // Strip the query strings. 
     290        $filename = str_replace('?','-', $filename); 
     291        $filename = str_replace('&','-', $filename); 
     292         
    289293        // Move the file to the uploads dir 
    290294        $new_file = $uploads['path'] . "/$filename"; 
    291295        if ( false === @ rename( $file['tmp_name'], $new_file ) ) {