Some attached files with non-ASCII names are unlinkable
|Reported by:||filosofo||Owned by:||ryan|
|Component:||General||Keywords:||has-patch attachment utf urlencode wp_unique_filename sanitize_title_with_dashes|
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 requesting wordpress-›-error.jpg, a file that doesn't exist. To be served a file named wordpress-%e2%80%ba-error.jpg, one would have to request instead wordpress-%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.
Change History (9)
- Milestone changed from 2.6 to 2.5.1
- Resolution set to fixed
- Status changed from new to closed