From 70c21f7f3e75260121a7df60bac16a4f6e6ee46d Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Fri, 15 Feb 2019 04:38:45 +0200 Subject: [PATCH] ssh: handle url without path https://discordapp.com/channels/485586884165107732/485596304961962003/545702950350356502 Signed-off-by: Ruslan Kuprieiev --- dvc/remote/ssh.py | 2 +- tests/unit/remote/ssh.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dvc/remote/ssh.py b/dvc/remote/ssh.py index a9072318f..1a2f6ee5e 100644 --- a/dvc/remote/ssh.py +++ b/dvc/remote/ssh.py @@ -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 diff --git a/tests/unit/remote/ssh.py b/tests/unit/remote/ssh.py index ad768806f..30a646a3e 100644 --- a/tests/unit/remote/ssh.py +++ b/tests/unit/remote/ssh.py @@ -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}