Path checking: Ensure windows outputs original path when warning
This commit is contained in:
parent
fe409ccefb
commit
0cb37abffe
1 changed files with 2 additions and 1 deletions
|
|
@ -141,6 +141,7 @@ def _path_normalised(unsafe_path_string: str) -> bool:
|
||||||
|
|
||||||
Warn and return false if . or .. is not at the start of the path.
|
Warn and return false if . or .. is not at the start of the path.
|
||||||
"""
|
"""
|
||||||
|
original_path = unsafe_path_string
|
||||||
# Ensure correct path separators before normalisation:
|
# Ensure correct path separators before normalisation:
|
||||||
if sys.platform.startswith("win"):
|
if sys.platform.startswith("win"):
|
||||||
unsafe_path_string = unsafe_path_string.replace("/", "\\")
|
unsafe_path_string = unsafe_path_string.replace("/", "\\")
|
||||||
|
|
@ -156,7 +157,7 @@ def _path_normalised(unsafe_path_string: str) -> bool:
|
||||||
|
|
||||||
if normalised != unsafe_path_string:
|
if normalised != unsafe_path_string:
|
||||||
LOGGER.warning(
|
LOGGER.warning(
|
||||||
f"File path {unsafe_path_string} may be unsafe due to unexpected relative "
|
f"File path {original_path} may be unsafe due to unexpected relative "
|
||||||
"navigation."
|
"navigation."
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue