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:
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user