mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-01 12:45:34 +00:00
make sure we do not get backslashes into item paths
on windows, we also want slashes, not backslashes.
This commit is contained in:
parent
db96c0c487
commit
b7ce3b1156
1 changed files with 2 additions and 0 deletions
|
@ -229,6 +229,8 @@ def make_path_safe(path):
|
|||
`path` contain any '..' elements.
|
||||
"""
|
||||
path = path.lstrip("/")
|
||||
if "\\" in path: # borg always wants slashes, never backslashes.
|
||||
raise ValueError(f"unexpected backslash(es) in path {path!r}")
|
||||
if path.startswith("../") or "/../" in path or path.endswith("/..") or path == "..":
|
||||
raise ValueError(f"unexpected '..' element in path {path!r}")
|
||||
path = os.path.normpath(path)
|
||||
|
|
Loading…
Reference in a new issue