Browse Source

Prevent template renderer from rendering error (#14646)

When there is a panic during template rendering unrolled/render
will automatically render the error. This leads to the
panic being displayed in the page and not a 500 page

Fix #14467
Fix #14525

Signed-off-by: Andrew Thornton <art27@cantab.net>
tags/v1.15.0-dev
zeripath 3 years ago
parent
commit
c9f1baf620
No account linked to committer's email address
1 changed files with 7 additions and 6 deletions
  1. 7
    6
      modules/templates/base.go

+ 7
- 6
modules/templates/base.go View File

@@ -86,11 +86,12 @@ func getDirAssetNames(dir string) []string {
// HTMLRenderer returns a render.
func HTMLRenderer() *render.Render {
return render.New(render.Options{
Extensions: []string{".tmpl"},
Directory: "templates",
Funcs: NewFuncMap(),
Asset: GetAsset,
AssetNames: GetAssetNames,
IsDevelopment: !setting.IsProd(),
Extensions: []string{".tmpl"},
Directory: "templates",
Funcs: NewFuncMap(),
Asset: GetAsset,
AssetNames: GetAssetNames,
IsDevelopment: !setting.IsProd(),
DisableHTTPErrorRendering: true,
})
}

Loading…
Cancel
Save