1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-10 04:27:22 +00:00

markdown: fix treating pure number as SHA1

- Detect non-exist commit and return 404 not 500
This commit is contained in:
Unknwon
2016-08-15 15:27:19 -07:00
parent 6c8fcb3af2
commit 4a46613916
5 changed files with 13 additions and 4 deletions

View File

@ -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
}