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
fix: patch config-ssh panic condition
  • Loading branch information
cmoog committed Jan 5, 2021
commit cd149c3fcb0bf0d31dc81b405a04274e76b0ea06
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