diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-05-30 15:04:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-30 07:04:01 +0000 |
commit | 015efcd8bfd451ef593192eb43cfcfb7001f7861 (patch) | |
tree | 73ebb78e07ed61b2f09f0a042f38bd68cbd0b9f1 /routers/common/markup.go | |
parent | d612a24e3e8cd288047448df86b69d00484dd183 (diff) | |
download | gitea-015efcd8bfd451ef593192eb43cfcfb7001f7861.tar.gz gitea-015efcd8bfd451ef593192eb43cfcfb7001f7861.zip |
Use repo as of renderctx's member rather than a repoPath on metas (#29222)
Use a `gitrepo.Repository` in the markup's RenderContext but not store
the repository's path.
Diffstat (limited to 'routers/common/markup.go')
-rw-r--r-- | routers/common/markup.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/common/markup.go b/routers/common/markup.go index 2d5638ef61..f7d096008a 100644 --- a/routers/common/markup.go +++ b/routers/common/markup.go @@ -9,6 +9,7 @@ import ( "net/http" "strings" + repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup/markdown" "code.gitea.io/gitea/modules/setting" @@ -66,7 +67,9 @@ func RenderMarkup(ctx *context.Base, repo *context.Repository, mode, text, urlPr } meta := map[string]string{} + var repoCtx *repo_model.Repository if repo != nil && repo.Repository != nil { + repoCtx = repo.Repository if mode == "comment" { meta = repo.Repository.ComposeMetas(ctx) } else { @@ -78,7 +81,8 @@ func RenderMarkup(ctx *context.Base, repo *context.Repository, mode, text, urlPr } if err := markup.Render(&markup.RenderContext{ - Ctx: ctx, + Ctx: ctx, + Repo: repoCtx, Links: markup.Links{ AbsolutePrefix: true, Base: urlPrefix, |