Refactor markup render system (#32533)
Remove unmaintainable sanitizer rules. No need to add special "class" regexp rules anymore, use RenderInternal.SafeAttr instead, more details (and examples) are in the tests
This commit is contained in:
parent
4f879a00df
commit
8a20fba8eb
42 changed files with 568 additions and 508 deletions
9
modules/markup/external/external.go
vendored
9
modules/markup/external/external.go
vendored
|
@ -102,7 +102,7 @@ func (p *Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.
|
|||
|
||||
_, err = io.Copy(f, input)
|
||||
if err != nil {
|
||||
f.Close()
|
||||
_ = f.Close()
|
||||
return fmt.Errorf("%s write data to temp file when rendering %s failed: %w", p.Name(), p.Command, err)
|
||||
}
|
||||
|
||||
|
@ -113,10 +113,9 @@ func (p *Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.
|
|||
args = append(args, f.Name())
|
||||
}
|
||||
|
||||
if ctx == nil || ctx.Ctx == nil {
|
||||
if ctx == nil {
|
||||
log.Warn("RenderContext not provided defaulting to empty ctx")
|
||||
ctx = &markup.RenderContext{}
|
||||
if ctx.Ctx == nil {
|
||||
if !setting.IsProd || setting.IsInTesting {
|
||||
panic("RenderContext did not provide context")
|
||||
}
|
||||
log.Warn("RenderContext did not provide context, defaulting to Shutdown context")
|
||||
ctx.Ctx = graceful.GetManager().ShutdownContext()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue