From 4a33d268abff5e853baaf3a88d091e03aea239d8 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 8 Apr 2008 17:22:20 +0000 Subject: [PATCH] Strip percent signs when sanitizing filenames so the server doesn't try to decode entities. Props filosofo. fixes #5587 for trunk git-svn-id: http://svn.automattic.com/wordpress/trunk@7631 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 96a814e72..e011d3407 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1142,7 +1142,8 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL ) $ext = strtolower( ".$ext" ); $filename = str_replace( $ext, '', $filename ); - $filename = sanitize_title_with_dashes( $filename ) . $ext; + // Strip % so the server doesn't try to decode entities. + $filename = str_replace('%', '', sanitize_title_with_dashes( $filename ) ) . $ext; while ( file_exists( $dir . "/$filename" ) ) { if ( '' == "$number$ext" )