Skip to content

Commit d5aeafd

Browse files
author
Gusted
committed
Use strings.Cut for GIT_PROTOCOL value
- As per go-gitea#20616 (comment)
1 parent 90b2657 commit d5aeafd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Diff for: modules/ssh/ssh.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ func sessionHandler(session ssh.Session) {
7878
gitProtocol := ""
7979
for _, env := range session.Environ() {
8080
if strings.HasPrefix(env, "GIT_PROTOCOL=") {
81-
// The value would be version=2, so using normal split doesn't work here.
82-
gitProtocol = strings.SplitN(env, "=", 2)[1]
81+
_, gitProtocol, _ = strings.Cut(env, "=")
8382
break
8483
}
8584
}

0 commit comments

Comments
 (0)