Changeset 35122
- Timestamp:
- 10/13/2015 03:21:13 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r34920 r35122 1369 1369 function sanitize_file_name( $filename ) { 1370 1370 $filename_raw = $filename; 1371 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0));1371 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", "%", "+", chr(0)); 1372 1372 /** 1373 1373 * Filter the list of characters to remove from a filename. -
trunk/tests/phpunit/tests/formatting/SanitizeFileName.php
r29290 r35122 12 12 13 13 function test_removes_special_chars() { 14 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0));14 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", "%", "+", chr(0)); 15 15 $string = 'test'; 16 16 foreach ( $special_chars as $char ) … … 27 27 function test_replace_spaces() { 28 28 $urls = array( 29 'unencoded space.png' 30 'encoded %20space.jpg'=> 'encoded-space.jpg',31 'plus+space.jpg' => 'plus-space.jpg',32 'multi %20 +space.png' => 'multi-space.png',29 'unencoded space.png' => 'unencoded-space.png', 30 'encoded-space.jpg' => 'encoded-space.jpg', 31 'plus+space.jpg' => 'plusspace.jpg', 32 'multi %20 +space.png' => 'multi-20-space.png', 33 33 ); 34 34 … … 50 50 $this->assertEquals("a-t", sanitize_file_name("a \n\n\nt")); 51 51 } 52 53 /** 54 * @ticket 16226 55 */ 56 function test_replaces_percent_sign() { 57 $this->assertEquals( 'a22b.jpg', sanitize_file_name( 'a%22b.jpg' ) ); 58 } 52 59 }
Note: See TracChangeset
for help on using the changeset viewer.