diff options
author | Unknwon <u@gogs.io> | 2016-08-15 15:27:19 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-15 15:27:19 -0700 |
commit | 4a46613916cdfa6a168746aba6abcd698cd17875 (patch) | |
tree | 0129f716668af004619b4cd7a937c0560d34ac0c /routers/repo | |
parent | 6c8fcb3af252f6dfc76021b5acb10ac672dd8ca4 (diff) | |
download | gitea-4a46613916cdfa6a168746aba6abcd698cd17875.tar.gz gitea-4a46613916cdfa6a168746aba6abcd698cd17875.zip |
markdown: fix treating pure number as SHA1
- Detect non-exist commit and return 404 not 500
Diffstat (limited to 'routers/repo')
-rw-r--r-- | routers/repo/commit.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go index c102ceae41..0dc0ceba55 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -152,7 +152,11 @@ func Diff(ctx *context.Context) { commit, err := ctx.Repo.GitRepo.GetCommit(commitID) if err != nil { - ctx.Handle(500, "Repo.GitRepo.GetCommit", err) + if git.IsErrNotExist(err) { + ctx.Handle(404, "Repo.GitRepo.GetCommit", err) + } else { + ctx.Handle(500, "Repo.GitRepo.GetCommit", err) + } return } |