From 58ed66d426d8daa357c6e4d9277c9610169876fb Mon Sep 17 00:00:00 2001 From: Las Zenow Date: Mon, 29 May 2017 09:45:38 +0000 Subject: [PATCH] Serve static files separately It was serving all static files returning the same last one. --- lib/trantor.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/trantor.go b/lib/trantor.go index 9ae5277..1bbf4a1 100644 --- a/lib/trantor.go +++ b/lib/trantor.go @@ -150,8 +150,9 @@ func InitRouter(db database.DB, sg *StatsGatherer, assetsPath string) { r.HandleFunc("/", sg.Gather(indexHandler)) for _, file := range []string{"robots.txt", "description.json", "opensearch.xml", "key.asc"} { + path := path.Join(assetsPath, file) serveFunc := func(w http.ResponseWriter, r *http.Request) { - http.ServeFile(w, r, path.Join(assetsPath, file)) + http.ServeFile(w, r, path) } r.HandleFunc("/"+file, serveFunc) }