[wp-trac] [WordPress Trac] #22363: Accentes in attachement filenames should be sanitized

WordPress Trac noreply at wordpress.org
Mon Nov 5 15:51:13 UTC 2012


#22363: Accentes in attachement filenames should be sanitized
-----------------------------+--------------------------
 Reporter:  tar.gz           |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Upload
  Version:  trunk            |   Severity:  normal
 Keywords:                   |
-----------------------------+--------------------------
 There is an inconsistency in the way WP is sanitizing post slugs and
 attachment filenames.

 Sanitizing the post slugs is a Good Thing(tm) for non-english users who
 use diacritics in their post titles.

 Example: If I write a post with the title "Moiré patterns", the actual
 page slug will be: "moire-patterns". The space is replaced with a hyphen,
 the "é" becomes "e". Even if I try to change the slug manually into
 "moiré", WP won't let me (for my own good, since that URL would break in
 lesser capable browsers).

 For some reason, WP doesn't apply that error-correction to attachment
 filenames.

 Example: If I attach a file named "moiré pattern.png", it gets renamed
 into "moiré-pattern.png".

 We can see that the space (and some other forbidden characters) are
 corrected by `sanitize_file_name()`, but diacritics such as "é" or "ä" are
 left as they are.

 Currently, most modern browsers are capable of displaying files with
 diacritics, but some of them still fail (most prominently, Safari).

 For the sake of cross-browser compatibility, attachment filenames should
 benefit from the same safety measures that we apply for the post slugs (I
 guess that's the `remove_accents()` function).

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22363>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list