Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
cdn-uri-encoding.patch | 1.11 KB | mr.baileys |
Comments
Comment #1
Wim LeersHah, good catch. Strange that I've never run into this problem!
Comment #2
Wim LeersThanks again! :) Committed.
D7: http://drupalcode.org/project/cdn.git/commit/b521cdb
D6: http://drupalcode.org/project/cdn.git/commit/4fdce7e
Comment #3
Wim LeersFollow-up patch for D6: http://drupalcode.org/project/cdn.git/commit/e4884cb. D6 should use drupal_urlencode(), not drupal_encode_path()…