From b0ff38946de4225331c32518adac25cf9933c244 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 11 Jan 2020 20:47:48 +0100 Subject: [PATCH] Fix request without filename Signed-off-by: Knut Ahlers --- assets.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/assets.go b/assets.go index 6ba26a1..ec0352d 100644 --- a/assets.go +++ b/assets.go @@ -8,7 +8,12 @@ import ( ) func serveAssets(res http.ResponseWriter, r *http.Request) { - data, err := Asset(path.Join("dist", r.RequestURI[1:])) + var fileName = r.RequestURI[1:] + if fileName == "" { + fileName = "index.html" + } + + data, err := Asset(path.Join("dist", fileName)) if err != nil { http.Error(res, "Not found", http.StatusNotFound) return