Add /favicon.ico route

This commit is contained in:
andreimarcu 2015-10-04 12:58:30 -04:00
parent d40803f165
commit 1e1c8caa53
2 changed files with 5 additions and 0 deletions

View file

@ -35,6 +35,10 @@ func staticHandler(c web.C, w http.ResponseWriter, r *http.Request) {
notFoundHandler(c, w, r)
return
} else {
if path == "/favicon.ico" {
path = "/static/images/favicon.gif"
}
filePath := strings.TrimPrefix(path, "/static/")
file, err := staticBox.Open(filePath)
if err != nil {

View file

@ -99,6 +99,7 @@ func setup() {
goji.Delete("/:name", deleteHandler)
goji.Get("/static/*", staticHandler)
goji.Get("/favicon.ico", staticHandler)
goji.Get(nameRe, fileDisplayHandler)
goji.Get(selifRe, fileServeHandler)
goji.Get(selifIndexRe, unauthorizedHandler)