From 439ace607d23e91da4b39a389730ab8a01c4eb56 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 18 Jun 2022 19:08:34 +0200 Subject: [PATCH] Return 404 when tag is broken (#20017) Fixes #19979 --- modules/context/repo.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/context/repo.go b/modules/context/repo.go index 8e75ad07d..217cbd3df 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -942,6 +942,10 @@ func RepoRefByType(refType RepoRefType, ignoreNotExistErr ...bool) func(*Context ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetTagCommit(refName) if err != nil { + if git.IsErrNotExist(err) { + ctx.NotFound("GetTagCommit", err) + return + } ctx.ServerError("GetTagCommit", err) return }