Ticket #16330: 16330.3.diff
File 16330.3.diff, 1.9 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/file.php
441 441 442 442 $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); 443 443 444 // Strip the query strings.445 $filename = str_replace('?','-', $filename);446 $filename = str_replace('&','-', $filename);447 448 444 // Move the file to the uploads dir 449 445 $new_file = $uploads['path'] . "/$filename"; 450 446 if ( false === @ rename( $file['tmp_name'], $new_file ) ) { -
wp-admin/includes/media.php
600 600 // Set variables for storage 601 601 // fix file filename for query strings 602 602 preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches ); 603 $file_array['name'] = basename($matches[0]);603 $file_array['name'] = urldecode( basename( $matches[0] ) ); 604 604 $file_array['tmp_name'] = $tmp; 605 605 606 606 // If error storing temporarily, unlink -
wp-includes/formatting.php
812 812 */ 813 813 function sanitize_file_name( $filename ) { 814 814 $filename_raw = $filename; 815 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0));815 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", "%", "+", chr(0)); 816 816 $special_chars = apply_filters('sanitize_file_name_chars', $special_chars, $filename_raw); 817 817 $filename = str_replace($special_chars, '', $filename); 818 818 $filename = preg_replace('/[\s-]+/', '-', $filename);