1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-07-25 12:39:40 +02: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
}