ssh:// URLs: remove support for /~otheruser/, see #6855

If you used this, just replace it by:

ssh://user@host:port/home/otheruser/
This commit is contained in:
Thomas Waldmann 2022-07-15 16:02:45 +02:00
parent 65703df839
commit 47c2672a64
3 changed files with 1 additions and 10 deletions

View File

@ -20,8 +20,6 @@ Note: you may also prepend a ``file://`` to a filesystem path to get URL style.
``ssh://user@host:port/~/path/to/repo`` - path relative to user's home directory
``ssh://user@host:port/~other/path/to/repo`` - path relative to other's home directory
If you frequently need the same repo URL, it is a good idea to set the
``BORG_REPO`` environment variable to set a default for the repo URL:

View File

@ -332,10 +332,8 @@ class RepositoryServer: # pragma: no cover
def _resolve_path(self, path):
if isinstance(path, bytes):
path = os.fsdecode(path)
if path.startswith("/~/"): # /~/x = path x relative to home dir
if path.startswith("/~/"): # /~/x = path x relative to own home dir
path = os.path.join(get_base_dir(), path[3:])
elif path.startswith("/~"): # /~username/x = relative to "user" home dir
path = os.path.expanduser(path[1:])
elif path.startswith("/./"): # /./x = path x relative to cwd
path = path[3:]
return os.path.realpath(path)

View File

@ -206,11 +206,6 @@ class TestLocationWithoutEnv:
== "Location(proto='ssh', user='user', host='host', port=None, path='/~/some/path')"
)
assert Location("ssh://user@host/~/some/path").to_key_filename() == keys_dir + "host__some_path"
assert (
repr(Location("ssh://user@host/~user/some/path"))
== "Location(proto='ssh', user='user', host='host', port=None, path='/~user/some/path')"
)
assert Location("ssh://user@host/~user/some/path").to_key_filename() == keys_dir + "host__user_some_path"
def test_with_colons(self, monkeypatch, keys_dir):
monkeypatch.delenv("BORG_REPO", raising=False)