ssh: handle url without path

https://discordapp.com/channels/485586884165107732/485596304961962003/545702950350356502

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2019-02-15 04:38:45 +02:00
parent dc5a676306
commit 70c21f7f3e
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -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
+5
View File
@@ -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}