|
|
|
|
@ -8,6 +8,7 @@ import (
|
|
|
|
|
"io/fs"
|
|
|
|
|
"log"
|
|
|
|
|
"net/http"
|
|
|
|
|
"net/url"
|
|
|
|
|
"strings"
|
|
|
|
|
"sync"
|
|
|
|
|
"time"
|
|
|
|
|
@ -79,9 +80,18 @@ func (s *Server) routes() {
|
|
|
|
|
w.Header().Set("Content-Type", "text/css")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Strip /static/ prefix before serving
|
|
|
|
|
r.URL.Path = strings.TrimPrefix(r.URL.Path, "/static")
|
|
|
|
|
fileServer.ServeHTTP(w, r)
|
|
|
|
|
// The key fix: properly handle the path
|
|
|
|
|
// Remove the /static prefix for the filesystem lookup
|
|
|
|
|
pathWithoutPrefix := strings.TrimPrefix(r.URL.Path, "/static")
|
|
|
|
|
|
|
|
|
|
// Create a new request with the modified path
|
|
|
|
|
r2 := new(http.Request)
|
|
|
|
|
*r2 = *r
|
|
|
|
|
r2.URL = new(url.URL)
|
|
|
|
|
*r2.URL = *r.URL
|
|
|
|
|
r2.URL.Path = pathWithoutPrefix
|
|
|
|
|
|
|
|
|
|
fileServer.ServeHTTP(w, r2)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// API routes
|
|
|
|
|
|