From 18f6fa052e107219c5d367234fa3d5d65b2a5246 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Thu, 8 Aug 2024 12:26:19 +0200 Subject: Set the theme before doing i18n During i18n printer resolution, if there is no locale cookie we render the language selection screen. When this screen is rendered it will grab the users theme from the current context. As a result of not having added the theme to the context yet though, we get a panic. To mitigate this we set the theme before doing any internationalization. --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index c30d46b..c1ad359 100644 --- a/main.go +++ b/main.go @@ -34,8 +34,8 @@ func main() { mux.Handle("GET /favicon.ico", fs) mux.Handle("GET /style.css", fs) mux.Handle("GET /", middleware.Pipe( - middleware.I18n, middleware.Theme, + middleware.I18n, )(http.HandlerFunc(finalHandler))) mux.Handle("POST /language", http.HandlerFunc(setUserLanguage)) -- cgit v1.2.3