Skip to content

Commit 78646e4

Browse files
committed
fix error page
1 parent a607ba4 commit 78646e4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

routers/common/errpage.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ func RenderPanicErrorPage(w http.ResponseWriter, req *http.Request, err any) {
3939
tmplCtx["Locale"] = middleware.Locale(w, req)
4040
ctxData := middleware.GetContextData(req.Context())
4141

42+
ctxData["Ctx"] = req.Context()
43+
4244
// This recovery handler could be called without Gitea's web context, so we shouldn't touch that context too much.
4345
// Otherwise, the 500-page may cause new panics, eg: cache.GetContextWithData, it makes the developer&users couldn't find the original panic.
4446
user, _ := ctxData[middleware.ContextDataKeySignedUser].(*user_model.User)

templates/status/500.tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{{/* This page should only depend the minimal template functions/variables, to avoid triggering new panics.
22
* base template functions: AppName, AssetUrlPrefix, AssetVersion, AppSubUrl, UserThemeName
33
* ctx.Locale
4+
* .Ctx
45
* .Flash
56
* .ErrorMsg
67
* .SignedUser (optional)
78
*/}}
89
<!DOCTYPE html>
9-
<html lang="{{ctx.Locale.Lang}}" data-theme="{{UserThemeName ctx .SignedUser}}">
10+
<html lang="{{ctx.Locale.Lang}}" data-theme="{{UserThemeName .Ctx .SignedUser}}">
1011
<head>
1112
<meta name="viewport" content="width=device-width, initial-scale=1">
1213
<title>Internal Server Error - {{AppName}}</title>

0 commit comments

Comments
 (0)