diff options
author | Unknwon <u@gogs.io> | 2017-04-04 02:01:29 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-04-04 02:01:29 -0400 |
commit | 41c8e87be8342392092eb74522068dd7452c15cd (patch) | |
tree | 746668185b3b79581bfab6e9bc4d3e743df08a6b /routers | |
parent | 55afc1ad21a6c5bebe7f7f8b6df8b0ee4308ba10 (diff) |
repo/commit: improve error detection
Response 404 not 500 for raw diff if object does not exist.
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/commit.go | 12 |
1 files changed, 6 insertions, 6 deletions
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 } } |