mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
fix: Avoid double escaping of ProxyCommand on Windows (#3664)
Fixes #2853
This commit is contained in:
committed by
GitHub
parent
09142255e6
commit
123fe0131e
@ -280,10 +280,16 @@ func configSSH() *cobra.Command {
|
|||||||
"\tLogLevel ERROR",
|
"\tLogLevel ERROR",
|
||||||
)
|
)
|
||||||
if !skipProxyCommand {
|
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 {
|
if !wireguard {
|
||||||
configOptions = append(configOptions, fmt.Sprintf("\tProxyCommand %q --global-config %q ssh --stdio %s", binaryFile, root, hostname))
|
//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))
|
||||||
} else {
|
} else {
|
||||||
configOptions = append(configOptions, fmt.Sprintf("\tProxyCommand %q --global-config %q ssh --wireguard --stdio %s", binaryFile, root, hostname))
|
//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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user