From f105e964daed35507da07bd9db5bc31b118b402d Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 4 Feb 2025 12:14:06 +0100 Subject: [PATCH] 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 --- cli/connhelper/connhelper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/connhelper/connhelper.go b/cli/connhelper/connhelper.go index 9e3347c84c..f4b9388599 100644 --- a/cli/connhelper/connhelper.go +++ b/cli/connhelper/connhelper.go @@ -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) }