mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-08 21:05:23 +00:00
parent
4e576d51c7
commit
83414b037d
2 changed files with 13 additions and 10 deletions
|
@ -469,7 +469,7 @@ class Location:
|
|||
|
||||
rclone_re = re.compile(
|
||||
r"""
|
||||
(?P<proto>rclone):// # rclone://
|
||||
(?P<proto>rclone): # rclone:
|
||||
(?P<path>(.*))
|
||||
""",
|
||||
re.VERBOSE,
|
||||
|
@ -616,13 +616,16 @@ class Location:
|
|||
path = "/./" + self.path # /./x = path x relative to cwd
|
||||
else:
|
||||
path = self.path
|
||||
return "{}://{}{}{}{}".format(
|
||||
self.proto if self.proto else "???",
|
||||
f"{self.user}@" if self.user else "",
|
||||
self._host if self._host else "", # needed for ipv6 addrs
|
||||
f":{self.port}" if self.port else "",
|
||||
path,
|
||||
)
|
||||
if self.proto == "rclone":
|
||||
return f"{self.proto}:{self.path}"
|
||||
else:
|
||||
return "{}://{}{}{}{}".format(
|
||||
self.proto if self.proto else "???",
|
||||
f"{self.user}@" if self.user else "",
|
||||
self._host if self._host else "", # needed for ipv6 addrs
|
||||
f":{self.port}" if self.port else "",
|
||||
path,
|
||||
)
|
||||
|
||||
def with_timestamp(self, timestamp):
|
||||
# note: this only affects the repository URL/path, not the archive name!
|
||||
|
|
|
@ -190,10 +190,10 @@ class TestLocationWithoutEnv:
|
|||
def test_rclone(self, monkeypatch, keys_dir):
|
||||
monkeypatch.delenv("BORG_REPO", raising=False)
|
||||
assert (
|
||||
repr(Location("rclone://remote:path"))
|
||||
repr(Location("rclone:remote:path"))
|
||||
== "Location(proto='rclone', user=None, host=None, port=None, path='remote:path')"
|
||||
)
|
||||
assert Location("rclone://remote:path").to_key_filename() == keys_dir + "remote_path"
|
||||
assert Location("rclone:remote:path").to_key_filename() == keys_dir + "remote_path"
|
||||
|
||||
def test_sftp(self, monkeypatch, keys_dir):
|
||||
monkeypatch.delenv("BORG_REPO", raising=False)
|
||||
|
|
Loading…
Add table
Reference in a new issue