From bc2512f8ccb25aee49ffe941c7eb3aa54aae5265 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 19 Mar 2014 07:15:23 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@27617 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/formatting.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index 919336df57..00d730b461 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -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, '.-_');