This commit is contained in:
IRONBEEM 2026-06-10 21:10:42 +08:00 committed by GitHub
commit 27c8ecf931
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 6 deletions

View file

@ -99,8 +99,18 @@ def test_custom_route_pattern_404(custom_pages_client):
assert ">Oh no</" in response.text
def test_custom_route_pattern_with_slash_slash_302(custom_pages_client):
# https://github.com/simonw/datasette/issues/2429
response = custom_pages_client.get("//example.com/")
@pytest.mark.parametrize(
"path",
(
# https://github.com/simonw/datasette/issues/2429
"//example.com/",
# https://github.com/simonw/datasette/issues/2680
# Browsers treat backslashes as slashes, so these are also open redirects
"/\\example.com/",
"/\\/example.com/",
),
)
def test_custom_route_pattern_open_redirect_302(custom_pages_client, path):
response = custom_pages_client.get(path)
assert response.status == 302
assert response.headers["location"] == "/example.com"