Skip to content

Commit 97a7324

Browse files
committed
server: replace relative_to check with is_relative_to
1 parent 08a0ec0 commit 97a7324

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Diff for: src/aioftp/server.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1033,9 +1033,7 @@ def get_paths(connection, path):
10331033
base_path = connection.user.base_path
10341034
real_path = base_path / str(resolved_virtual_path.relative_to("/"))
10351035
# replace with `is_relative_to` check after 3.9+ requirements lands
1036-
try:
1037-
real_path.relative_to(base_path)
1038-
except ValueError:
1036+
if not real_path.is_relative_to(base_path):
10391037
real_path = base_path
10401038
resolved_virtual_path = pathlib.PurePosixPath("/")
10411039
return real_path, resolved_virtual_path

0 commit comments

Comments
 (0)