[development] upload module or maybe url() bug

David Timothy Strauss david at fourkitchens.com
Mon Jun 30 20:16:10 UTC 2008


See this issue:
http://drupal.org/node/191116

Translating spaces to "+" is not RFC-compliant. For maximum compatibility, you should encode both spaces and plus signs using % notation.

----- "Matt Connolly" <matt at cabinetuk.com> wrote:

> I have a question about url encoding
> 
> Spaces in URLS are normally translated to "%20" and spaces in queries 
> 
> are normally translated into "+", although the "%20" is correctly  
> decoded.
> 
> I'm discovering that private file uploads are not working when there 
> 
> is a "+" in the file name. This is being translated into a " " (space)
>  
> which is quite normal for queries.
> 
> With public downloads, (ie accessibly directly via
> http://mydrupalsite/sites/files/fred+wilma.jpg 
> " the file works. So apache doesn't translate the + in the file's path
>  
> name into a space, and the file is downloaded.
> 
> With private downloads, the file name is placed into a query, thanks 
> 
> to mod_rewrite (or, becomes
> http://mydrupalsite/q?=system/files/fred+wilma.jpg 
> " . You can see where the problem is.
> 
> 
> I can easily fix this by altering the "file_create_url" function in "/
> 
> includes/file.inc". I know I've been warned to not change drupal's  
> core modules and code, but ..... I think I need to.
> 
> However, I wonder if the problem would be better handled in the  
> "url()" function?
> 
> I notice that if you create page url's "bananas+pears" and "apples and
>  
> oranges" the urls are all encoded with %20. So it seems you can't use 
> 
> the "+" in a custom URL. Butt least here what you type and what you  
> get are consistent.
> 
> 
> Any thoughts?
> -Matt


More information about the development mailing list