If you upload a file with an ampersand in the name, say "hello&world.jpg" there are two issues:
1) The link when displaying as a link to the original gets parsed incorrectly. This is a drupal issue which I opened a bug report for here: http://drupal.org/node/303987
2) The cache of the image never gets created. From what I can tell the following happens:
This imagecache url becomes something like: http://www.example.com/sites/default/files/imagecache/thumbnail/hello&wo....
Mod rewrite then parses it to become: http://www.example.com/?q=sites/default/files/imagecache/thumbnail/hello...
So it never sees the &world.jpg part of the file and starts looking for the file sites/default/files/hello (as opposed to sites/default/files/hello&world.jpg).

I assume the same type of issue would occur if a file had a question mark or the hash symbol (? and #).

Comments

Antoine Lafontaine’s picture

I suppose that the file name should be sanitized. I'm not sure at what level it should be provided, but you might find the transliteration module useful to massage those problematic character when a file is uploaded.

drewish’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

j0rd’s picture

same problem it seems. Using latest version under Drupal 6.

hanoii’s picture

Version: 6.x-1.0-alpha2 » 6.x-2.0-beta9
Status: Closed (fixed) » Active
StatusFileSize
new654 bytes
new670 bytes

I can confirm this still happens on latest drupal 5.x and 6.x version. I found this:

http://www.computerminds.co.uk/drupal-imagecache-problems-special-charac...

Which gives a workaround to that issue, but I'd think it should be fixed in the module.

I also noticed on the dev version the transliteration support, not sure if this patch might conflict with it, it might not, but I think it worth taking a look at this issue.
Also, transliteration support might be good to backport it to D5?

Anyway, attached is both patch to D5 and D6. The fix is the same, although because drupal_urleconde() implementation is different in D5 than in D6 I had to run it twice in D5 to make it work properly.

a.=

hanoii’s picture

Status: Active » Needs review
drewish’s picture

Status: Needs review » Closed (duplicate)