URL Double Encode

harking - July 6, 2009 - 17:20
Project:Path Filter
Version:6.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

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

mrfelton - September 27, 2009 - 15:55
Status:active» postponed (maintainer needs more info)

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

mrfelton - September 27, 2009 - 17:33
Status:postponed (maintainer needs more info)» fixed

I tested this and it seems to work fine. Please try the new version 2 beta.

#3

System Message - October 11, 2009 - 17:40
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.