Doesn't work when served trough web2py, even if converted to unicode and 
even if additionally percent-escaped. I see these choices:

- serve the file from the same location but directly trough another web 
server, bypassing web2py altogether (works fine in apache)
- if the contract must be served trough web2py and stored directly into 
static/documents, a quick and dirty solution would be to use pinyin rather 
than Chinese characters in the file name. Mei wenti :)
- if the file name must contain characters, you can use web2py's 
upload/download mechanism to upload / encode and later decode / retrieve 
the file name safely
- if you want to skip using the database, you could write a custom download 
function by using response.stream and response.headers.

In case of a custom function I'd be careful about directory traversal or 
any similar vectors of attack. Web2py's upload/download mechanism has this 
taken care of. And I'd test this download separately in IE, in any case. 
I've stumbled on IE's quirks with such file names before...

Regards


On Saturday, June 2, 2012 9:08:28 AM UTC+2, Bruce Wade wrote:
>
> http://127.0.0.1:8000/yaw/en/static/documents/adspaces.js?attachement  
> allows me to download the js file
> http://127.0.0.1:8000/yaw/en/static/documents/�得世界网广告服务协议.pdf?attachement 
> gives me "Invalid Request" both files exist.
>
> Basically I have some files in static/documents I want to allow to be 
> downloaded. What is the correct way to accomplish this?
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>

Reply via email to