mirror of
https://github.com/Garmelon/PFERD.git
synced 2026-04-12 15:35:05 +02: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
1 changed files with 1 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue