[wp-trac] [WordPress Trac] #5587: Some attached files with
non-ASCII names are unlinkable
WordPress Trac
wp-trac at lists.automattic.com
Sat Jan 5 16:20:13 GMT 2008
#5587: Some attached files with non-ASCII names are unlinkable
----------------------+-----------------------------------------------------
Reporter: filosofo | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.5
Component: General | Version: 2.3.2
Severity: normal | Keywords: 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.
1. Upload a file named {{{WordPress › Error.jpg}}}
1. 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}}}
1. 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.
--
Ticket URL: <http://trac.wordpress.org/ticket/5587>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list