mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Media: Filter out a few more special characters in sanitize_file_name().
Props audrasjb. Fixes #50231. git-svn-id: https://develop.svn.wordpress.org/trunk@48596 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
1191967083
commit
3ebdc35d36
@ -1985,7 +1985,7 @@ function remove_accents( $string ) {
|
||||
*/
|
||||
function sanitize_file_name( $filename ) {
|
||||
$filename_raw = $filename;
|
||||
$special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', chr( 0 ) );
|
||||
$special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', '’', '«', '»', '”', '“', chr( 0 ) );
|
||||
|
||||
// Check for support for utf8 in the installed PCRE library once and store the result in a static.
|
||||
static $utf8_pcre = null;
|
||||
|
||||
@ -11,7 +11,7 @@ class Tests_Formatting_SanitizeFileName extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
function test_removes_special_chars() {
|
||||
$special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', chr( 0 ) );
|
||||
$special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', '’', '«', '»', '”', '“', chr( 0 ) );
|
||||
$string = 'test';
|
||||
foreach ( $special_chars as $char ) {
|
||||
$string .= $char;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user