On 26 Jul 2012, at 8:50 PM, Mark Li <[email protected]> wrote:
> I have a static file named 

> 
> person---dog-3.jpg
> 
> When I try to access the file through 
> http://127.0.0.1:8000/myapp/static/pets/person---dog-3.jpg
> I get an "invalid request" error.
> 
> However, if I rename the file to person-dog-3.jpg, it works fine.
> I have a very large number of files named this way (with consecutive 
> hyphens), and it worked fine on other sites, just not working for web2py. Any 
> idea how I can make this work without renaming all the files?

It's a legacy web2py thing. If you use the parametric router, you can redefine 
the relevant regex in your app's router, changing

        file_match = r'(\w+[-=./]?)+$',    # legal file (path) name

to

        file_match = r'([-=\w]+[./]?)+$',    # legal file (path) name

or something like it.

-- 



Reply via email to