From 1aa5dc75df71c31dc70d321c128c05f1f4d5a1cb Mon Sep 17 00:00:00 2001 From: Abheek Dhawan <67982792+ADawesomeguy@users.noreply.github.com> Date: Sun, 20 Mar 2022 19:28:35 -0500 Subject: [PATCH] Use custom favicon when viewing static files if it exists (#19130) (#19152) Redirect `/favicon.ico` to `/assets/img/favicon.png`. Fix #19109 Co-authored-by: zeripath --- routers/web/web.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routers/web/web.go b/routers/web/web.go index 1eea2794b0..d3b891ce31 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -98,6 +98,11 @@ func Routes(sessioner func(http.Handler) http.Handler) *web.Route { http.Redirect(w, req, path.Join(setting.StaticURLPrefix, "/assets/img/apple-touch-icon.png"), 301) }) + // redirect default favicon to the path of the custom favicon with a default as a fallback + routes.Get("/favicon.ico", func(w http.ResponseWriter, req *http.Request) { + http.Redirect(w, req, path.Join(setting.StaticURLPrefix, "/assets/img/favicon.png"), 301) + }) + common := []interface{}{} if setting.EnableGzip {