fix: avoid markup render panic (#38698) (#38703)

backport #38698, fix #38697
This commit is contained in:
wxiaoguang
2026-07-30 13:41:12 +08:00
committed by GitHub
parent 9eac9bd032
commit d2603a8b4a
5 changed files with 40 additions and 51 deletions
+1 -1
View File
@@ -58,9 +58,9 @@ func NewRenderContextRepoFile(ctx context.Context, repo *repo_model.Repository,
helper := &RepoFile{opts: util.OptionalArg(opts)}
rctx := markup.NewRenderContext(ctx)
helper.ctx = rctx
helper.commitChecker = newCommitChecker(ctx, repo)
if repo != nil {
helper.repoLink = repo.Link()
helper.commitChecker = newCommitChecker(ctx, repo)
rctx = rctx.WithMetas(repo.ComposeRepoFileMetas(ctx))
} else {
// this is almost dead code, only to pass the incorrect tests