Ticket #16330: 16330.2.diff
File 16330.2.diff, 2.0 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/file.php
461 461 462 462 $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); 463 463 464 // Strip the query strings.465 $filename = str_replace('?','-', $filename);466 $filename = str_replace('&','-', $filename);467 468 464 // Move the file to the uploads dir 469 465 $new_file = $uploads['path'] . "/$filename"; 470 466 if ( false === @ rename( $file['tmp_name'], $new_file ) ) { -
wp-admin/includes/media.php
588 588 // Set variables for storage 589 589 // fix file filename for query strings 590 590 preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $file, $matches); 591 $file_array['name'] = basename($matches[0]);591 $file_array['name'] = urldecode( basename( $matches[0] ) ); 592 592 $file_array['tmp_name'] = $tmp; 593 593 594 594 // If error storing temporarily, unlink -
wp-includes/formatting.php
714 714 */ 715 715 function sanitize_file_name( $filename ) { 716 716 $filename_raw = $filename; 717 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0));717 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", "%", "+", chr(0)); 718 718 $special_chars = apply_filters('sanitize_file_name_chars', $special_chars, $filename_raw); 719 719 $filename = str_replace($special_chars, '', $filename); 720 720 $filename = preg_replace('/[\s-]+/', '-', $filename);