Make WordPress Core

Ticket #16330: 16330.4.diff

File 16330.4.diff, 1.9 KB (added by mattheu, 10 years ago)

Refreshed to merge cleanly

  • wp-admin/includes/file.php

    diff --git wp-admin/includes/file.php wp-admin/includes/file.php
    index d81dd52..b604774 100644
    function wp_handle_sideload( &$file, $overrides = false, $time = null ) { 
    447447
    448448        $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
    449449
    450         // Strip the query strings.
    451         $filename = str_replace('?','-', $filename);
    452         $filename = str_replace('&','-', $filename);
    453 
    454450        // Move the file to the uploads dir
    455451        $new_file = $uploads['path'] . "/$filename";
    456452        if ( false === @ rename( $file['tmp_name'], $new_file ) ) {
  • wp-admin/includes/media.php

    diff --git wp-admin/includes/media.php wp-admin/includes/media.php
    index f942bb2..2aa6347 100644
    function media_sideload_image($file, $post_id, $desc = null) { 
    808808                // Set variables for storage
    809809                // fix file filename for query strings
    810810                preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
    811                 $file_array['name'] = basename($matches[0]);
     811                $file_array['name'] = urldecode( basename( $matches[0] ) );
    812812                $file_array['tmp_name'] = $tmp;
    813813
    814814                // If error storing temporarily, unlink
  • wp-includes/formatting.php

    diff --git wp-includes/formatting.php wp-includes/formatting.php
    index 5efe0cd..562d8fd 100644
    function remove_accents($string) { 
    921921 */
    922922function sanitize_file_name( $filename ) {
    923923        $filename_raw = $filename;
    924         $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0));
     924        $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", "%", "+", chr(0));
    925925        /**
    926926         * Filter the list of characters to remove from a filename.
    927927         *