LFS: Fix SSH authentication for trailing arguments (#1328)

Fixes #1296
release/v1.15
Fabian Zaremba 2017-03-22 11:43:28 +01:00 committed by Lunny Xiao
parent c05bd1789c
commit 9224405155
1 changed files with 5 additions and 3 deletions

View File

@ -123,8 +123,8 @@ func runServ(c *cli.Context) error {
fail("Unknown git command", "LFS authentication request over SSH denied, LFS support is disabled") fail("Unknown git command", "LFS authentication request over SSH denied, LFS support is disabled")
} }
if strings.Contains(args, " ") { argsSplit := strings.Split(args, " ")
argsSplit := strings.SplitN(args, " ", 2) if len(argsSplit) >= 2 {
args = strings.TrimSpace(argsSplit[0]) args = strings.TrimSpace(argsSplit[0])
lfsVerb = strings.TrimSpace(argsSplit[1]) lfsVerb = strings.TrimSpace(argsSplit[1])
} }
@ -179,8 +179,10 @@ func runServ(c *cli.Context) error {
if verb == lfsAuthenticateVerb { if verb == lfsAuthenticateVerb {
if lfsVerb == "upload" { if lfsVerb == "upload" {
requestedMode = models.AccessModeWrite requestedMode = models.AccessModeWrite
} else { } else if lfsVerb == "download" {
requestedMode = models.AccessModeRead requestedMode = models.AccessModeRead
} else {
fail("Unknown LFS verb", "Unkown lfs verb %s", lfsVerb)
} }
} }