Skip to content

Commit c9f1baf

Browse files
authored
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 <[email protected]>
1 parent b3c2e23 commit c9f1baf

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

modules/templates/base.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@ func getDirAssetNames(dir string) []string {
8686
// HTMLRenderer returns a render.
8787
func HTMLRenderer() *render.Render {
8888
return render.New(render.Options{
89-
Extensions: []string{".tmpl"},
90-
Directory: "templates",
91-
Funcs: NewFuncMap(),
92-
Asset: GetAsset,
93-
AssetNames: GetAssetNames,
94-
IsDevelopment: !setting.IsProd(),
89+
Extensions: []string{".tmpl"},
90+
Directory: "templates",
91+
Funcs: NewFuncMap(),
92+
Asset: GetAsset,
93+
AssetNames: GetAssetNames,
94+
IsDevelopment: !setting.IsProd(),
95+
DisableHTTPErrorRendering: true,
9596
})
9697
}

0 commit comments

Comments
 (0)