diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 8a088c98e..8f119f40d 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -311,14 +311,14 @@ func Download(ctx *context.Context) { ctx.Handle(500, "GetTagCommit", err) return } - } else if len(refName) == 40 { + } else if len(refName) >= 7 && len(refName) <= 40 { commit, err = gitRepo.GetCommit(refName) if err != nil { - ctx.Handle(404, "GetCommit", nil) + ctx.NotFound() return } } else { - ctx.Handle(404, "Download", nil) + ctx.NotFound() return }