diff options
author | zeripath <art27@cantab.net> | 2021-02-13 19:41:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-13 19:41:53 +0000 |
commit | c9f1baf62024017f1dfb2f582252978828a92f15 (patch) | |
tree | d677c2de174c54100bb5790bd712dc892b7befc7 /modules/templates/base.go | |
parent | b3c2e23cbbfc6386f0d35e252051f9f74f548f98 (diff) | |
download | gitea-c9f1baf62024017f1dfb2f582252978828a92f15.tar.gz gitea-c9f1baf62024017f1dfb2f582252978828a92f15.zip |
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>
Diffstat (limited to 'modules/templates/base.go')
-rw-r--r-- | modules/templates/base.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/templates/base.go b/modules/templates/base.go index ff31c12899..cb83143bd3 100644 --- a/modules/templates/base.go +++ b/modules/templates/base.go @@ -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, }) } |