Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit b2a4c96

Browse files
authored
fix: patch config-ssh panic condition (#210)
1 parent 84f8540 commit b2a4c96

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

internal/cmd/configssh.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,10 @@ func removeOldConfig(config string) (string, bool) {
152152
if startIndex == -1 || endIndex == -1 {
153153
return config, false
154154
}
155-
config = config[:startIndex-1] + config[endIndex+len(sshEndToken)+1:]
156-
157-
return config, true
155+
if startIndex == 0 {
156+
return config[endIndex+len(sshEndToken)+1:], true
157+
}
158+
return config[:startIndex-1] + config[endIndex+len(sshEndToken)+1:], true
158159
}
159160

160161
// sshAvailable returns true if SSH is available for at least one environment.

0 commit comments

Comments
 (0)