From 13b880395fa50accf87a33daf676dde69fe4b92f Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Fri, 26 Aug 2022 17:27:22 +0300 Subject: [PATCH] Revert "fix: Avoid double escaping of ProxyCommand on Windows (#3664)" This reverts commit 123fe0131eacef645c64c60226a64c097abc5906. --- cli/configssh.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cli/configssh.go b/cli/configssh.go index b84a42331275a..40a5f49406b10 100644 --- a/cli/configssh.go +++ b/cli/configssh.go @@ -280,16 +280,10 @@ func configSSH() *cobra.Command { "\tLogLevel ERROR", ) if !skipProxyCommand { - // In SSH configs, strings inside "" are interpreted literally and there - // is no need to e.g. escape backslashes (common on Windows platforms). - // We will escape the quotes, though. - escapedBinaryFile := strings.ReplaceAll(binaryFile, "\"", "\\\"") if !wireguard { - //nolint:gocritic // We don't want to use %q here, see above. - configOptions = append(configOptions, fmt.Sprintf("\tProxyCommand \"%s\" --global-config \"%s\" ssh --stdio %s", escapedBinaryFile, root, hostname)) + configOptions = append(configOptions, fmt.Sprintf("\tProxyCommand %q --global-config %q ssh --stdio %s", binaryFile, root, hostname)) } else { - //nolint:gocritic // We don't want to use %q here, see above. - configOptions = append(configOptions, fmt.Sprintf("\tProxyCommand \"%s\" --global-config \"%s\" ssh --wireguard --stdio %s", escapedBinaryFile, root, hostname)) + configOptions = append(configOptions, fmt.Sprintf("\tProxyCommand %q --global-config %q ssh --wireguard --stdio %s", binaryFile, root, hostname)) } }