1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-27 02:08:54 +00:00

we remove scp style, also remove it for tilde expansion, fixes #6856

This commit is contained in:
Thomas Waldmann 2022-07-13 16:42:46 +02:00
parent ca74118b61
commit 1de12eacb7

View file

@ -332,15 +332,10 @@ def negotiate(self, client_data):
def _resolve_path(self, path):
if isinstance(path, bytes):
path = os.fsdecode(path)
# Leading slash is always present with URI (ssh://), but not with short-form (who@host:path).
if path.startswith("/~/"): # /~/x = path x relative to home dir
path = os.path.join(get_base_dir(), path[3:])
elif path.startswith("~/"):
path = os.path.join(get_base_dir(), path[2:])
elif path.startswith("/~"): # /~username/x = relative to "user" home dir
path = os.path.expanduser(path[1:])
elif path.startswith("~"):
path = os.path.expanduser(path)
elif path.startswith("/./"): # /./x = path x relative to cwd
path = path[3:]
return os.path.realpath(path)