In `sanitize_file_name()`, replace a UTF-8-encoded Unicode representation of a non-breaking space (`\u00a0` / `\xc2\xa`) with an old-fashioned space: ` `.

Fixes #27281.


Built from https://develop.svn.wordpress.org/trunk@27617


git-svn-id: http://core.svn.wordpress.org/trunk@27460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-03-19 07:16:15 +00:00
parent d21ba271cc
commit 0f55595472
1 changed files with 1 additions and 0 deletions

View File

@ -888,6 +888,7 @@ function sanitize_file_name( $filename ) {
* @param string $filename_raw Filename as it was passed into sanitize_file_name().
*/
$special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );
$filename = preg_replace( "#\x{00a0}#siu", ' ', $filename );
$filename = str_replace($special_chars, '', $filename);
$filename = preg_replace('/[\s-]+/', '-', $filename);
$filename = trim($filename, '.-_');