diff options
author | Abheek Dhawan <67982792+ADawesomeguy@users.noreply.github.com> | 2022-03-19 14:53:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-19 19:53:31 +0000 |
commit | f96e8be41fe2cc36858bd4a673847bb388ce178a (patch) | |
tree | 5e95d990fd0490ecf2cf0afa7f17d8b63d808dab /routers | |
parent | 3322f4d7ccc2f2f372407b246df010bc84464c15 (diff) | |
download | gitea-f96e8be41fe2cc36858bd4a673847bb388ce178a.tar.gz gitea-f96e8be41fe2cc36858bd4a673847bb388ce178a.zip |
Use custom favicon when viewing static files if it exists (#19130)
Redirect `/favicon.ico` to `/assets/img/favicon.png`.
Fix #19109
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/web.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/web/web.go b/routers/web/web.go index 9faa61e560..6d2fbedace 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -99,6 +99,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 { |