mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Now reformatted with black
This commit is contained in:
parent
37b14800e5
commit
e967301ab4
2 changed files with 3 additions and 2 deletions
|
|
@ -1811,7 +1811,7 @@ class DatasetteRouter:
|
||||||
|
|
||||||
# If you redirect with a // at the beginning, you end up with an open redirect, so
|
# If you redirect with a // at the beginning, you end up with an open redirect, so
|
||||||
# https://my.site//foo/ - will redirect to https://foo
|
# https://my.site//foo/ - will redirect to https://foo
|
||||||
path = re.sub(rb'^/+', b'/', path)
|
path = re.sub(rb"^/+", b"/", path)
|
||||||
|
|
||||||
if request.scope["query_string"]:
|
if request.scope["query_string"]:
|
||||||
path += b"?" + request.scope["query_string"]
|
path += b"?" + request.scope["query_string"]
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,8 @@ def test_custom_route_pattern_404(custom_pages_client):
|
||||||
assert "<h1>Error 404</h1>" in response.text
|
assert "<h1>Error 404</h1>" in response.text
|
||||||
assert ">Oh no</" in response.text
|
assert ">Oh no</" in response.text
|
||||||
|
|
||||||
|
|
||||||
def test_custom_route_pattern_with_slash_slash_302(custom_pages_client):
|
def test_custom_route_pattern_with_slash_slash_302(custom_pages_client):
|
||||||
response = custom_pages_client.get("//nastyOpenRedirect/")
|
response = custom_pages_client.get("//nastyOpenRedirect/")
|
||||||
assert response.status == 302
|
assert response.status == 302
|
||||||
assert response.headers['location'] == "/nastyOpenRedirect"
|
assert response.headers["location"] == "/nastyOpenRedirect"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue