1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-28 02:38:43 +00:00

Merge pull request #7664 from ThomasWaldmann/test-for-backslashes

no backslashes
This commit is contained in:
TW 2023-06-22 21:41:37 +02:00 committed by GitHub
commit 67a32ee603
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -229,8 +229,6 @@ def make_path_safe(path):
`path` contain any '..' elements. `path` contain any '..' elements.
""" """
path = path.lstrip("/") 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 == "..": if path.startswith("../") or "/../" in path or path.endswith("/..") or path == "..":
raise ValueError(f"unexpected '..' element in path {path!r}") raise ValueError(f"unexpected '..' element in path {path!r}")
path = os.path.normpath(path) path = os.path.normpath(path)