Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions web/backend/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"embed"
"io/fs"
"log"
"mime"
"net/http"
"path"
"strings"
Expand All @@ -14,6 +15,13 @@ var frontendFS embed.FS

// registerEmbedRoutes sets up the HTTP handler to serve the embedded frontend files
func registerEmbedRoutes(mux *http.ServeMux) {
// Register correct MIME type for SVG files
// Go's built-in mime.TypeByExtension returns "image/svg" which is incorrect
// The correct MIME type per RFC 6838 is "image/svg+xml"
if err := mime.AddExtensionType(".svg", "image/svg+xml"); err != nil {
log.Printf("Warning: failed to register SVG MIME type: %v", err)
}

// Attempt to get the subdirectory 'dist' where Vite usually builds
subFS, err := fs.Sub(frontendFS, "dist")
if err != nil {
Expand Down
Loading