cli/connhelper: don't parse URL twice
This function was parsing the same URL twice; first to detect the scheme, then again (through ssh.ParseURL) to construct a ssh.Spec. Change the function to use the URL that's parsed, and use ssh.NewSpec instead. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
11b53dabc6
commit
f105e964da
@ -41,7 +41,7 @@ func getConnectionHelper(daemonURL string, sshFlags []string) (*ConnectionHelper
|
||||
return nil, err
|
||||
}
|
||||
if u.Scheme == "ssh" {
|
||||
sp, err := ssh.ParseURL(daemonURL)
|
||||
sp, err := ssh.NewSpec(u)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("ssh host connection is not valid: %w", err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user