#5587 closed defect (bug) (fixed)
Some attached files with non-ASCII names are unlinkable
Reported by: | filosofo | Owned by: | ryan |
---|---|---|---|
Milestone: | 2.5.1 | Priority: | normal |
Severity: | normal | Version: | 2.3.2 |
Component: | General | Keywords: | has-patch attachment utf urlencode wp_unique_filename sanitize_title_with_dashes |
Focuses: | Cc: |
Description
This will be tough to reproduce in current trunk while the inline uploader is missing, but you can see it happen in 2.3.2.
- Upload a file named
WordPress › Error.jpg
- wp_unique_filename, calling sanitize_title_with_dashes, which in turn calls utf8_uri_encode, changes the filename and its url to
wordpress-%e2%80%ba-error.jpg
- When WordPress links to this file as an attachment, it breaks the link. That's because the server sees the encoded text
%e2%80%ba
, and converting it back, thinks you're requestingwordpress-›-error.jpg
, a file that doesn't exist. To be served a file namedwordpress-%e2%80%ba-error.jpg
, one would have to request insteadwordpress-%25e2%2580%25ba-error.jpg
My patch strips out the percentage character (%
) in wp_unique_filename, so that this confusion is avoided. It seems somewhat like a hack, so perhaps someone else can think of a better solution.
Attachments (1)
Change History (9)
#4
@
17 years ago
- Milestone changed from 2.6 to 2.5.1
- Resolution set to fixed
- Status changed from new to closed
It would be great to see this inside the next revision (2.5.1). In the support forums many users report errors with the new uploader and this reduce some of them. I just checked against version 2.5 and 2.6 bleeding and the error is still in. This patch would at least fix the problem. Therefore some naming information from the filename is ok to loose.
#5
@
17 years ago
Additionally, a comment should be put inside the sourcecode to reference this ticket.
duplicated in #5826