Prevent endless loop if templates missing (#14752)
Since the chi upgrade if the templates are missing an endless loop will occur if status/500.tmpl is missing. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
91424fff3d
commit
65c940f66c
1 changed files with 4 additions and 0 deletions
|
@ -188,6 +188,10 @@ func (ctx *Context) HTML(status int, name base.TplName) {
|
|||
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
|
||||
}
|
||||
if err := ctx.Render.HTML(ctx.Resp, status, string(name), ctx.Data); err != nil {
|
||||
if status == http.StatusInternalServerError && name == base.TplName("status/500") {
|
||||
ctx.PlainText(http.StatusInternalServerError, []byte("Unable to find status/500 template"))
|
||||
return
|
||||
}
|
||||
ctx.ServerError("Render failed", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue