From 90fedf86d9a058d2bcceda7205df99f93750a07c Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 29 Oct 2017 13:40:15 +1300 Subject: [PATCH] serve proper 404 if favicon.ico not configured --- WikiServer.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/WikiServer.go b/WikiServer.go index effd1d9..c36d35f 100644 --- a/WikiServer.go +++ b/WikiServer.go @@ -112,9 +112,13 @@ func (this *WikiServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.Write(content) return - } else if remainingPath == "favicon.ico" && len(this.opts.FaviconFilePath) > 0 { - w.Header().Set("Content-Type", "image/x-icon") - http.ServeFile(w, r, this.opts.FaviconFilePath) + } else if remainingPath == "favicon.ico" { + if len(this.opts.FaviconFilePath) > 0 { + w.Header().Set("Content-Type", "image/x-icon") + http.ServeFile(w, r, this.opts.FaviconFilePath) + } else { + http.Error(w, "Not found", 404) + } return } else if remainingPath == "download-database" {