Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#24117 closed defect (bug) (duplicate)

Multisite installations using ms-files.php rewriting can't handle uploaded files with plus sign (+) in the file name

Reported by: jamescollins's profile jamescollins Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Multisite Keywords: has-patch
Focuses: Cc:

Description

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:

http://domain.com/files/file-name-here+.pdf

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:

http://domain.com/wp-content/blogs/dir/1/file-name-here+.pdf

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.

Attachments (1)

24117.diff (833 bytes) - added by jamescollins 12 years ago.

Download all attachments as: .zip

Change History (7)

@jamescollins
12 years ago

#1 @jamescollins
12 years ago

  • Keywords has-patch added

24117.diff​ automatically removes the plus sign character from file names during the upload process.

This solution solves the problem for new files that are uploaded, however it doesn't solve it for existing media library files that contain a plus sign in their name.

#2 @jamescollins
12 years ago

Related: #22813

FYI, we are using Apache.

#3 @SergeyBiryukov
12 years ago

Sounds like a duplicate of #22813 and probably #16330 (the patch there suggests the same change).

#4 @jamescollins
12 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #22813.

#5 @jamescollins
12 years ago

  • Keywords has-patch removed

#6 @SergeyBiryukov
12 years ago

  • Keywords has-patch added
  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.