@@ -12,7 +12,6 @@ import (
1212 "runtime"
1313 "strings"
1414
15- "code.gitea.io/gitea/modules/graceful"
1615 "code.gitea.io/gitea/modules/log"
1716 "code.gitea.io/gitea/modules/markup"
1817 "code.gitea.io/gitea/modules/process"
@@ -80,8 +79,8 @@ func envMark(envName string) string {
8079func (p * Renderer ) Render (ctx * markup.RenderContext , input io.Reader , output io.Writer ) error {
8180 var (
8281 command = strings .NewReplacer (
83- envMark ("GITEA_PREFIX_SRC" ), ctx .Links .SrcLink (),
84- envMark ("GITEA_PREFIX_RAW" ), ctx .Links .RawLink (),
82+ envMark ("GITEA_PREFIX_SRC" ), ctx .RenderOptions . Links .SrcLink (),
83+ envMark ("GITEA_PREFIX_RAW" ), ctx .RenderOptions . Links .RawLink (),
8584 ).Replace (p .Command )
8685 commands = strings .Fields (command )
8786 args = commands [1 :]
@@ -113,22 +112,14 @@ func (p *Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.
113112 args = append (args , f .Name ())
114113 }
115114
116- if ctx .Ctx == nil {
117- if ! setting .IsProd || setting .IsInTesting {
118- panic ("RenderContext did not provide context" )
119- }
120- log .Warn ("RenderContext did not provide context, defaulting to Shutdown context" )
121- ctx .Ctx = graceful .GetManager ().ShutdownContext ()
122- }
123-
124- processCtx , _ , finished := process .GetManager ().AddContext (ctx .Ctx , fmt .Sprintf ("Render [%s] for %s" , commands [0 ], ctx .Links .SrcLink ()))
115+ processCtx , _ , finished := process .GetManager ().AddContext (ctx , fmt .Sprintf ("Render [%s] for %s" , commands [0 ], ctx .RenderOptions .Links .SrcLink ()))
125116 defer finished ()
126117
127118 cmd := exec .CommandContext (processCtx , commands [0 ], args ... )
128119 cmd .Env = append (
129120 os .Environ (),
130- "GITEA_PREFIX_SRC=" + ctx .Links .SrcLink (),
131- "GITEA_PREFIX_RAW=" + ctx .Links .RawLink (),
121+ "GITEA_PREFIX_SRC=" + ctx .RenderOptions . Links .SrcLink (),
122+ "GITEA_PREFIX_RAW=" + ctx .RenderOptions . Links .RawLink (),
132123 )
133124 if ! p .IsInputFile {
134125 cmd .Stdin = input
0 commit comments