diff options
author | Fabian Zaremba <fabian@youremail.eu> | 2017-03-22 11:43:28 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-03-22 18:43:28 +0800 |
commit | 9224405155322e096e7f2d0f9eed35633b937951 (patch) | |
tree | 35f35468ef78c4fc68f7203da4e8651b14fda2ba /cmd/serv.go | |
parent | c05bd1789c6f0a4952ad7625b7eb3b144ae89f9b (diff) | |
download | gitea-9224405155322e096e7f2d0f9eed35633b937951.tar.gz gitea-9224405155322e096e7f2d0f9eed35633b937951.zip |
LFS: Fix SSH authentication for trailing arguments (#1328)
Fixes #1296
Diffstat (limited to 'cmd/serv.go')
-rw-r--r-- | cmd/serv.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd/serv.go b/cmd/serv.go index d9d32217c8..dc8952abe9 100644 --- a/cmd/serv.go +++ b/cmd/serv.go @@ -123,8 +123,8 @@ func runServ(c *cli.Context) error { fail("Unknown git command", "LFS authentication request over SSH denied, LFS support is disabled") } - if strings.Contains(args, " ") { - argsSplit := strings.SplitN(args, " ", 2) + argsSplit := strings.Split(args, " ") + if len(argsSplit) >= 2 { args = strings.TrimSpace(argsSplit[0]) lfsVerb = strings.TrimSpace(argsSplit[1]) } @@ -179,8 +179,10 @@ func runServ(c *cli.Context) error { if verb == lfsAuthenticateVerb { if lfsVerb == "upload" { requestedMode = models.AccessModeWrite - } else { + } else if lfsVerb == "download" { requestedMode = models.AccessModeRead + } else { + fail("Unknown LFS verb", "Unkown lfs verb %s", lfsVerb) } } |