mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Fix resolve_path allowing paths outside its folder
This happened if the directory name was a prefix of the offending file name.
This commit is contained in:
parent
63bbcad918
commit
135a8dce4b
@ -67,7 +67,7 @@ def resolve_path(directory: Path, target_file: Path) -> Path:
|
|||||||
"""
|
"""
|
||||||
absolute_path = directory.joinpath(target_file).resolve()
|
absolute_path = directory.joinpath(target_file).resolve()
|
||||||
|
|
||||||
if not str(absolute_path).startswith(str(directory.resolve())):
|
if directory not in absolute_path.parents:
|
||||||
raise ResolveException(
|
raise ResolveException(
|
||||||
f"Path resolved to file outside folder ({absolute_path})"
|
f"Path resolved to file outside folder ({absolute_path})"
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user