From 1e1c8caa53331bad2afd0ac511839471a2f461dd Mon Sep 17 00:00:00 2001 From: andreimarcu Date: Sun, 4 Oct 2015 12:58:30 -0400 Subject: [PATCH] Add /favicon.ico route --- fileserve.go | 4 ++++ server.go | 1 + 2 files changed, 5 insertions(+) diff --git a/fileserve.go b/fileserve.go index b568ce3..e1d2e16 100644 --- a/fileserve.go +++ b/fileserve.go @@ -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 { diff --git a/server.go b/server.go index 7fac1b8..2f314ec 100644 --- a/server.go +++ b/server.go @@ -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)