Use pathlib for path resolution (#2506)

This commit is contained in:
Adam Hopkins
2022-07-31 08:49:02 +03:00
committed by GitHub
parent 2fa28f1711
commit e100a14fd4
3 changed files with 37 additions and 34 deletions

View File

@@ -616,8 +616,11 @@ def test_dotted_dir_ok(
def test_breakout(app: Sanic, static_file_directory: str):
app.static("/foo", static_file_directory)
_, response = app.test_client.get("/foo/..%2Ffake/server.py")
assert response.status == 404
_, response = app.test_client.get("/foo/..%2Fstatic/test.file")
assert response.status == 400
assert response.status == 404
@pytest.mark.skipif(
@@ -629,6 +632,6 @@ def test_double_backslash_prohibited_on_win32(
app.static("/foo", static_file_directory)
_, response = app.test_client.get("/foo/static/..\\static/test.file")
assert response.status == 400
assert response.status == 404
_, response = app.test_client.get("/foo/static\\../static/test.file")
assert response.status == 400
assert response.status == 404