refactor: markup render (#38864) (#38869)

backport #38864

1. add missing CSP header to api & web render endpoints.
2. make jupyter render skip post-processors, nothing to process
This commit is contained in:
wxiaoguang
2026-08-12 00:00:47 +08:00
committed by GitHub
parent 9ab9c18919
commit 21fda8f5be
14 changed files with 70 additions and 69 deletions
+3
View File
@@ -64,6 +64,9 @@ func RenderFile(ctx *context.Context) {
extRendererOpts := extRenderer.GetExternalRendererOptions()
if extRendererOpts.ContentSandbox != "" {
ctx.Resp.Header().Add("Content-Security-Policy", "sandbox "+extRendererOpts.ContentSandbox)
} else {
// if no sandbox, just apply the same CSP as a general Gitea web page
ctx.SetHeaderContentSecurityPolicyGeneral()
}
err = markup.RenderWithRenderer(rctx, renderer, rendererInput, ctx.Resp)