From d2b308ae3594afa8c2a5f2a797c4723bc4e0e948 Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 14 Dec 2020 12:45:33 +0000 Subject: [PATCH] Ensure template renderer is available before storage handler (#13982) `ctx.Error` requires that templates are available for this to render the error page otherwise there will be a panic at this time. This was fixed in #13164 but was not completely backported. Fix #13971 Signed-off-by: Andrew Thornton --- routers/routes/routes.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 586474a66..a7b5b5b58 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -223,10 +223,11 @@ func NewMacaron() *macaron.Macaron { }, )) + m.Use(templates.HTMLRenderer()) + m.Use(storageHandler(setting.Avatar.Storage, "avatars", storage.Avatars)) m.Use(storageHandler(setting.RepoAvatar.Storage, "repo-avatars", storage.RepoAvatars)) - m.Use(templates.HTMLRenderer()) mailer.InitMailRender(templates.Mailer()) localeNames, err := options.Dir("locale")