Browse Source

Add /favicon.ico route

pull/40/head
andreimarcu 9 years ago
parent
commit
1e1c8caa53
  1. 4
      fileserve.go
  2. 1
      server.go

4
fileserve.go

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

1
server.go

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

Loading…
Cancel
Save