After calling getExernalWrapper(), CDN decodes the uri to perform file-based operations. The URI is never re-encoded though, causing file-names with funky characters (or Unicode) to not be valid. Most browsers seem to still accept them, but stricter tools complain, and some files will break even in the less strict browsers.

For example, on Ubuntu for a file named 'file?&©2012.png' (and yes, unfortunately we've got creative editors who upload all kinds of insanely-named files ;) ):

  • uri returned by getExternalUri(): sites/default/files/styles/medium/public/field/image/file%3F%26%C2%A92012.png
  • uri after being decoded by CDN: sites/default/files/styles/medium/public/field/image/file?&©2012.png
  • expected CDN FF uri: cdn/farfuture/ufi-method:ufi-value/sites/default/files/styles/medium/public/field/image/file%3F%26%C2%A92012.png
  • actual CDN FF uri: cdn/farfuture/ufi-method:ufi-value/sites/default/files/styles/medium/public/field/image/file?&©2012.png
CommentFileSizeAuthor
cdn-uri-encoding.patch1.11 KBmr.baileys
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

Hah, good catch. Strange that I've never run into this problem!

Wim Leers’s picture

Title: Farfuture URLs are not properly escaped. » Far Future file URLs are not properly encoded
Status: Reviewed & tested by the community » Fixed
Wim Leers’s picture

Follow-up patch for D6: http://drupalcode.org/project/cdn.git/commit/e4884cb. D6 should use drupal_urlencode(), not drupal_encode_path()…

Status: Fixed » Closed (fixed)

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