From 41c8e87be8342392092eb74522068dd7452c15cd Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 4 Apr 2017 02:01:29 -0400 Subject: repo/commit: improve error detection Response 404 not 500 for raw diff if object does not exist. --- routers/repo/commit.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'routers') diff --git a/routers/repo/commit.go b/routers/repo/commit.go index bf03d53e..21e5e916 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -179,14 +179,14 @@ func Diff(ctx *context.Context) { ctx.HTML(200, DIFF) } -func RawDiff(ctx *context.Context) { +func RawDiff(c *context.Context) { if err := git.GetRawDiff( - models.RepoPath(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name), - ctx.Params(":sha"), - git.RawDiffType(ctx.Params(":ext")), - ctx.Resp, + models.RepoPath(c.Repo.Owner.Name, c.Repo.Repository.Name), + c.Params(":sha"), + git.RawDiffType(c.Params(":ext")), + c.Resp, ); err != nil { - ctx.Handle(500, "GetRawDiff", err) + c.NotFoundOrServerError("GetRawDiff", git.IsErrNotExist, err) return } } -- cgit v1.2.3