From 25785a920aa51423210b9e986e8a2578d9145a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 13 Dec 2019 16:26:27 +0100 Subject: [PATCH] fix serving static issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- middleware/static.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/middleware/static.go b/middleware/static.go index ae06aacbc..01bf4af94 100644 --- a/middleware/static.go +++ b/middleware/static.go @@ -8,8 +8,12 @@ import ( // Static is a middleware that serves static assets. func Static(root string, fs http.FileSystem) func(http.Handler) http.Handler { + if !strings.HasSuffix(root, "/") { + root = root + "/" + } + static := http.StripPrefix( - root+"/", + root, http.FileServer( fs, ),