Fix tests.

This commit is contained in:
grossmj
2021-05-15 19:43:36 +09:30
parent 6294ad9e76
commit 9a6978902d
7 changed files with 36 additions and 23 deletions

View File

@ -43,8 +43,7 @@ def is_safe_path(file_path, directory):
(the file is stored inside directory or one of its sub-directory)
"""
requested_path = os.path.relpath(file_path, start=directory)
requested_path = os.path.abspath(requested_path)
requested_path = os.path.abspath(file_path)
common_prefix = os.path.commonprefix([requested_path, directory])
return common_prefix != directory