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:
parent
d21ba271cc
commit
0f55595472
|
@ -888,6 +888,7 @@ function sanitize_file_name( $filename ) {
|
||||||
* @param string $filename_raw Filename as it was passed into sanitize_file_name().
|
* @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 );
|
$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 = str_replace($special_chars, '', $filename);
|
||||||
$filename = preg_replace('/[\s-]+/', '-', $filename);
|
$filename = preg_replace('/[\s-]+/', '-', $filename);
|
||||||
$filename = trim($filename, '.-_');
|
$filename = trim($filename, '.-_');
|
||||||
|
|
Loading…
Reference in New Issue