summaryrefslogtreecommitdiffstats
path: root/modules/markup
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2024-08-09 15:43:23 +0800
committerGitHub <noreply@github.com>2024-08-09 15:43:23 +0800
commit144648a4afdd93d534875a86c50ec61c860878f3 (patch)
treea2dd9b878a0bcf8e0676aa051cd71386499380bb /modules/markup
parent8d11946d67043535dec850c7872d895e77e3afbe (diff)
downloadgitea-144648a4afdd93d534875a86c50ec61c860878f3.tar.gz
gitea-144648a4afdd93d534875a86c50ec61c860878f3.zip
Fix `IsObjectExist` with gogit (#31790) (#31806)
Backport #31790 by @wolfogre Fix #31271. When gogit is enabled, `IsObjectExist` calls `repo.gogitRepo.ResolveRevision`, which is not correct. It's for checking references not objects, it could work with commit hash since it's both a valid reference and a commit object, but it doesn't work with blob objects. So it causes #31271 because it reports that all blob objects do not exist. Co-authored-by: Jason Song <i@wolfogre.com>
Diffstat (limited to 'modules/markup')
-rw-r--r--modules/markup/html.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/markup/html.go b/modules/markup/html.go
index d0498074e1..86e96253da 100644
--- a/modules/markup/html.go
+++ b/modules/markup/html.go
@@ -1159,7 +1159,8 @@ func hashCurrentPatternProcessor(ctx *RenderContext, node *html.Node) {
})
}
- exist = ctx.GitRepo.IsObjectExist(hash)
+ // Don't use IsObjectExist since it doesn't support short hashs with gogit edition.
+ exist = ctx.GitRepo.IsReferenceExist(hash)
ctx.ShaExistCache[hash] = exist
}