Skip to content

Commit

Permalink
Use strings.Cut for GIT_PROTOCOL value (go-gitea#20638)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gusted authored and Sysoev, Vladimir committed Aug 10, 2022
1 parent 5abf809 commit b8290b9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions modules/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ func sessionHandler(session ssh.Session) {
gitProtocol := ""
for _, env := range session.Environ() {
if strings.HasPrefix(env, "GIT_PROTOCOL=") {
// The value would be version=2, so using normal split doesn't work here.
gitProtocol = strings.SplitN(env, "=", 2)[1]
_, gitProtocol, _ = strings.Cut(env, "=")
break
}
}
Expand Down

0 comments on commit b8290b9

Please sign in to comment.