Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit123fe01

Browse files
authored
fix: Avoid double escaping of ProxyCommand on Windows (#3664)
Fixes#2853
1 parent0914225 commit123fe01

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎cli/configssh.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,16 @@ func configSSH() *cobra.Command {
280280
"\tLogLevel ERROR",
281281
)
282282
if!skipProxyCommand {
283+
// In SSH configs, strings inside "" are interpreted literally and there
284+
// is no need to e.g. escape backslashes (common on Windows platforms).
285+
// We will escape the quotes, though.
286+
escapedBinaryFile:=strings.ReplaceAll(binaryFile,"\"","\\\"")
283287
if!wireguard {
284-
configOptions=append(configOptions,fmt.Sprintf("\tProxyCommand %q --global-config %q ssh --stdio %s",binaryFile,root,hostname))
288+
//nolint:gocritic // We don't want to use %q here, see above.
289+
configOptions=append(configOptions,fmt.Sprintf("\tProxyCommand\"%s\" --global-config\"%s\" ssh --stdio %s",escapedBinaryFile,root,hostname))
285290
}else {
286-
configOptions=append(configOptions,fmt.Sprintf("\tProxyCommand %q --global-config %q ssh --wireguard --stdio %s",binaryFile,root,hostname))
291+
//nolint:gocritic // We don't want to use %q here, see above.
292+
configOptions=append(configOptions,fmt.Sprintf("\tProxyCommand\"%s\" --global-config\"%s\" ssh --wireguard --stdio %s",escapedBinaryFile,root,hostname))
287293
}
288294
}
289295

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp