URL Double Encode
| Project: | Path Filter |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
While working with the IMCE file uploader in combination with file names that include characters which need to be URL encoded such as:
http://example.com/sites/default/files/file name with spaces in it.pdf
IMCE will return the URL to the file URL Encoded as:
http://example.com/sites/default/files/file%20name%20with%20spaces%20in%20it.pdf
We then modify the URL to include "internal:" as needed.
Pathfilter will then pass the URL through the url() function which calls drupal_urlencode(), causing a second encoding of the URL into:
http://example.com/sites/default/files/file%2520name%2520with%2520spaces%2520in%2520it.pdf
One solution would be to de-urlencode the URL before it is passed into the url() function.
Another solution would be to use an custom URL function that does not re-encode it.

#1
Perhaps you should try with the latest -dev code, which now also includes a files: filter allowing you to easily link to files in your files directory (#127484: [Push #2] pathfilter for files directory). When you use files: file_create_url() is used instead of url(), so I think this will fix your issue. Please give it a try and let me know if you still have the double encoding issue.
#2
I tested this and it seems to work fine. Please try the new version 2 beta.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.