mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-24 11:09:44 +08:00
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
@ -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…
Reference in New Issue
Block a user