You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a project I need a directory structures for images, where each directory name may have undesirable characters such as /. To solve this I am URL-quoting directory names on the filesystem. That means I have paths such as media/help/tops/halter%20tops/one%2Btwo/image 1.jpg . I can build a static URL for those in the usual way, for example request.static_url('mypackage:templates/media/help/tops/halter%20tops/image 1.jpg, which results in the URL http://localhost/media/help/tops/halter%20tops/image 1.jpg. This URL has a problem when used as-is: the spaces and %-sign still need to be quoted. This is problem one:
static_url should probably do URL-quoting
as a workaround I modified my code to double-quote the directory names and quote the filenames. That results in URLs such as http://localhost/media/help/hater%2520tops/image%201.jpg. This still does not work: something in the pyramid is double-unquoting incoming paths, and as a result I still get a 404. This is the second problem:
PATH_INFO is URL-unquoted twice for static views, leading to problems with filesystem paths that themselves use URL-quoting
as a last attempt I tried to tripple-quote everything. This produces lovely URLs such as http://localhost/media/help/hater%252520tops/image%25201.jpg, but does end up working.
The text was updated successfully, but these errors were encountered:
…quoted
URLs when fed a ``path`` argument which contains characters that are
unsuitable for URLs. See #349 for
more information.
- Backport from master: fix ``request.json_body`` to deal with alternate
request charsets.
Ref: issue #349.
For a project I need a directory structures for images, where each directory name may have undesirable characters such as /. To solve this I am URL-quoting directory names on the filesystem. That means I have paths such as
media/help/tops/halter%20tops/one%2Btwo/image 1.jpg
. I can build a static URL for those in the usual way, for examplerequest.static_url('mypackage:templates/media/help/tops/halter%20tops/image 1.jpg
, which results in the URLhttp://localhost/media/help/tops/halter%20tops/image 1.jpg
. This URL has a problem when used as-is: the spaces and %-sign still need to be quoted. This is problem one:as a workaround I modified my code to double-quote the directory names and quote the filenames. That results in URLs such as
http://localhost/media/help/hater%2520tops/image%201.jpg
. This still does not work: something in the pyramid is double-unquoting incoming paths, and as a result I still get a 404. This is the second problem:as a last attempt I tried to tripple-quote everything. This produces lovely URLs such as
http://localhost/media/help/hater%252520tops/image%25201.jpg
, but does end up working.The text was updated successfully, but these errors were encountered: