Skip to content

Commit db00324

Browse files
committed
try to fix symlink test
1 parent 674fc7c commit db00324

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/test_server/test_utils.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ def test_catch_unsafe_relative_path_traversal(tmp_path, bad_path):
6767

6868

6969
def test_catch_unsafe_symlink_path_traversal(tmp_path):
70-
symlink: Path = tmp_path / "file.txt"
71-
symlink.symlink_to(tmp_path.parent / "escaped-file.txt")
70+
root: Path = tmp_path / "root"
71+
root.mkdir()
72+
file: Path = root / "file.txt"
73+
escaped_file = root.parent / "escaped-file.txt"
74+
file.symlink_to(escaped_file)
75+
7276
with pytest.raises(ValueError, match="Unsafe path"):
73-
traversal_safe_path(tmp_path, "file.txt")
77+
traversal_safe_path(root, file.name)

0 commit comments

Comments
 (0)