diff --git a/server/static.go b/server/static.go index 21b0a57..0c429a7 100644 --- a/server/static.go +++ b/server/static.go @@ -4,9 +4,14 @@ import ( "local/dndex/config" "local/simpleserve/simpleserve" "net/http" + "os" + "path" ) func (rest *REST) static(w http.ResponseWriter, r *http.Request) { + if _, err := os.Stat(path.Join(config.New().StaticRoot, r.URL.Path)); os.IsNotExist(err) { + r.URL.Path = "/" + } simpleserve.SetContentTypeIfMedia(w, r) server := http.FileServer(http.Dir(config.New().StaticRoot)) server.ServeHTTP(w, r)