Skip to content

Commit

Permalink
Use custom favicon when viewing static files if it exists (go-gitea#1…
Browse files Browse the repository at this point in the history
…9130)

Redirect `/favicon.ico` to `/assets/img/favicon.png`.

Fix go-gitea#19109
  • Loading branch information
abheekda1 authored and Stelios Malathouras committed Mar 28, 2022
1 parent f0b8c37 commit 9eb08df
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions routers/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9eb08df

Please sign in to comment.