aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-08-03 00:34:50 +0200
committerGitHub <noreply@github.com>2022-08-03 01:34:50 +0300
commit87a7c37ecb4ddb2116cb4e853a61781d0de37ddb (patch)
tree473e2656126963c2026cd0a15971b53b352832dc /modules
parent90b2657ae7f022f0a9fe2ba7199c60d32a36d673 (diff)
downloadgitea-87a7c37ecb4ddb2116cb4e853a61781d0de37ddb.tar.gz
gitea-87a7c37ecb4ddb2116cb4e853a61781d0de37ddb.zip
Use `strings.Cut` for GIT_PROTOCOL value (#20638)
- As per https://github.com/go-gitea/gitea/pull/20616#discussion_r935612542
Diffstat (limited to 'modules')
-rw-r--r--modules/ssh/ssh.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go
index 5cc011e581..6b601c008f 100644
--- a/modules/ssh/ssh.go
+++ b/modules/ssh/ssh.go
@@ -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
}
}