diff options
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/http.go | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go index cac1ec335f..c5b45f9cc8 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -64,23 +64,9 @@ func HTTP(ctx *context.Context) { reponame = reponame[:len(reponame)-5] } - repoUser, err := models.GetUserByName(username) + repo, err := models.GetRepositoryByOwnerAndName(username, reponame) if err != nil { - if models.IsErrUserNotExist(err) { - ctx.Handle(http.StatusNotFound, "GetUserByName", nil) - } else { - ctx.Handle(http.StatusInternalServerError, "GetUserByName", err) - } - return - } - - repo, err := models.GetRepositoryByName(repoUser.ID, reponame) - if err != nil { - if models.IsErrRepoNotExist(err) { - ctx.Handle(http.StatusNotFound, "GetRepositoryByName", nil) - } else { - ctx.Handle(http.StatusInternalServerError, "GetRepositoryByName", err) - } + ctx.NotFoundOrServerError("GetRepositoryByOwnerAndName", models.IsErrRepoNotExist, err) return } |