SSH does not parse port from hostname when not using a ssh:// URL

This commit is contained in:
Kovid Goyal 2023-09-09 09:33:47 +05:30
parent 6fef176918
commit 73b1e3b8a1
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 1 additions and 2 deletions

View file

@ -136,7 +136,7 @@ func TestSSHConfigParsing(t *testing.T) {
u, _ := user.Current()
un := u.Username
for _, x := range []Pair{
{"localhost:12", un, "localhost"},
{"localhost:12", un, "localhost:12"},
{"@localhost", un, "@localhost"},
{"ssh://@localhost:33", un, "localhost"},
{"me@localhost", "me", "localhost"},

View file

@ -67,7 +67,6 @@ func get_destination(hostname string) (username, hostname_for_match string) {
_, hostname_for_match, _ = strings.Cut(hostname, "@")
parsed = true
}
hostname_for_match, _, _ = strings.Cut(hostname_for_match, ":")
return
}