Fix MIME type handling for static files
- Fixed static file path construction in staticFileHandler - Removed duplicate 'static' prefix that was causing incorrect file paths - Now properly serves CSS and JS files with correct MIME types - Resolves browser security errors from MIME type mismatches 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
7340a9d6eb
commit
559e1d23b9
1 changed files with 2 additions and 1 deletions
|
|
@ -410,7 +410,8 @@ func (s *Server) handleFavicon(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
func (s *Server) staticFileHandler() http.Handler {
|
func (s *Server) staticFileHandler() http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
filePath := "static" + r.URL.Path
|
// Remove /static/ prefix from URL path to get the actual file path
|
||||||
|
filePath := "static" + r.URL.Path[len("/static"):]
|
||||||
|
|
||||||
data, err := s.staticFiles.ReadFile(filePath)
|
data, err := s.staticFiles.ReadFile(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue