Skip to content

Commit 1aa5dc7

Browse files
abheekda1zeripath
andauthored
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 <[email protected]>
1 parent ee234af commit 1aa5dc7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

routers/web/web.go

+5
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ func Routes(sessioner func(http.Handler) http.Handler) *web.Route {
9898
http.Redirect(w, req, path.Join(setting.StaticURLPrefix, "/assets/img/apple-touch-icon.png"), 301)
9999
})
100100

101+
// redirect default favicon to the path of the custom favicon with a default as a fallback
102+
routes.Get("/favicon.ico", func(w http.ResponseWriter, req *http.Request) {
103+
http.Redirect(w, req, path.Join(setting.StaticURLPrefix, "/assets/img/favicon.png"), 301)
104+
})
105+
101106
common := []interface{}{}
102107

103108
if setting.EnableGzip {

0 commit comments

Comments
 (0)