1
0
Fork 0
mirror of https://github.com/Luzifer/cloudkeys-go.git synced 2024-11-08 22:20:05 +00:00

Fix request without filename

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-01-11 20:47:48 +01:00
parent 9bd560a05a
commit b0ff38946d
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -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