mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-12-03 07:18:28 +01:00
ssh: handle url without path
https://discordapp.com/channels/485586884165107732/485596304961962003/545702950350356502 Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+1
-1
@@ -70,7 +70,7 @@ class RemoteSSH(RemoteBase):
|
||||
or parsed.username
|
||||
or getpass.getuser()
|
||||
)
|
||||
self.prefix = parsed.path
|
||||
self.prefix = parsed.path or "/"
|
||||
self.port = (
|
||||
config.get(Config.SECTION_REMOTE_PORT)
|
||||
or parsed.port
|
||||
|
||||
@@ -51,6 +51,11 @@ class TestRemoteSSH(TestCase):
|
||||
self.assertEqual(remote.port, remote.DEFAULT_PORT)
|
||||
self.assertEqual(remote.prefix, path)
|
||||
|
||||
def test_no_path(self):
|
||||
config = {"url": "ssh://127.0.0.1"}
|
||||
remote = RemoteSSH(None, config)
|
||||
self.assertEqual(remote.prefix, "/")
|
||||
|
||||
def test_port(self):
|
||||
url = "ssh://127.0.0.1/path/to/dir"
|
||||
config = {"url": url}
|
||||
|
||||
Reference in New Issue
Block a user