Multisite installations using ms-files.php rewriting can't handle uploaded files with plus sign (+) in the file name
|Reported by:||jamescollins||Owned by:|
On a WordPress Multisite network that uses ms-files.php rewriting, if you upload a file with a plus sign in the file name then the file isn't accessible via the default /files/ URL.
Steps to reproduce:
On a Multisite installation that was set up prior to WP 3.5), upload a file with a plus sign in the file name (eg file name here+.pdf), WordPress renames the file to file-name-here+.pdf.
The file's URL is then:
However loading that URL results in a 404 error.
However manually requesting the file via the non-pretty URL (ie not going via ms-files.php) does work:
ms-files.php attempts to locate this file:
/path/to/wordpress/wp-content/blogs.dir/1/files/file-name-here .pdf which doesn't exist, because the file on the filesystem still has the plus sign in the name (/path/to/wordpress/wp-content/blogs.dir/1/files/file-name-here+.pdf.
I think WordPress' sanitize_file_name() function should automatically remove the + character from file names during the upload process.