diff options
Diffstat (limited to 'cmd/serv.go')
-rw-r--r-- | cmd/serv.go | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/cmd/serv.go b/cmd/serv.go index 5dc3785852..1ff296d007 100644 --- a/cmd/serv.go +++ b/cmd/serv.go @@ -158,18 +158,10 @@ func runServ(c *cli.Context) error { } os.Setenv(models.EnvRepoName, reponame) - repoUser, err := models.GetUserByName(username) - if err != nil { - if models.IsErrUserNotExist(err) { - fail("Repository owner does not exist", "Unregistered owner: %s", username) - } - fail("Internal error", "Failed to get repository owner (%s): %v", username, err) - } - - repo, err := models.GetRepositoryByName(repoUser.ID, reponame) + repo, err := models.GetRepositoryByOwnerAndName(username, reponame) if err != nil { if models.IsErrRepoNotExist(err) { - fail(accessDenied, "Repository does not exist: %s/%s", repoUser.Name, reponame) + fail(accessDenied, "Repository does not exist: %s/%s", username, reponame) } fail("Internal error", "Failed to get repository: %v", err) } @@ -263,7 +255,7 @@ func runServ(c *cli.Context) error { //LFS token authentication if verb == lfsAuthenticateVerb { - url := fmt.Sprintf("%s%s/%s.git/info/lfs", setting.AppURL, repoUser.Name, repo.Name) + url := fmt.Sprintf("%s%s/%s.git/info/lfs", setting.AppURL, username, repo.Name) now := time.Now() token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ |