serve proper 404 if favicon.ico not configured

This commit is contained in:
mappu 2017-10-29 13:40:15 +13:00
parent a9a6b51a3f
commit 90fedf86d9

View File

@ -112,9 +112,13 @@ func (this *WikiServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Write(content) w.Write(content)
return return
} else if remainingPath == "favicon.ico" && len(this.opts.FaviconFilePath) > 0 { } else if remainingPath == "favicon.ico" {
w.Header().Set("Content-Type", "image/x-icon") if len(this.opts.FaviconFilePath) > 0 {
http.ServeFile(w, r, this.opts.FaviconFilePath) w.Header().Set("Content-Type", "image/x-icon")
http.ServeFile(w, r, this.opts.FaviconFilePath)
} else {
http.Error(w, "Not found", 404)
}
return return
} else if remainingPath == "download-database" { } else if remainingPath == "download-database" {