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

fix: patch config-ssh panic condition #210

Merged
merged 1 commit into from
Jan 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions internal/cmd/configssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,10 @@ func removeOldConfig(config string) (string, bool) {
if startIndex == -1 || endIndex == -1 {
return config, false
}
config = config[:startIndex-1] + config[endIndex+len(sshEndToken)+1:]

return config, true
if startIndex == 0 {
return config[endIndex+len(sshEndToken)+1:], true
}
return config[:startIndex-1] + config[endIndex+len(sshEndToken)+1:], true
}

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