fix(web): correct SVG MIME type from image/svg to image/svg+xml
Go's mime package doesn't register .svg with the correct type by default, causing browsers to reject SVG resources when used with CSS mask-image. Fixes #1410
This commit is contained in:
parent
19835b2f60
commit
78c9d0d1bf
1 changed files with 7 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"embed"
|
||||
"io/fs"
|
||||
"log"
|
||||
"mime"
|
||||
"net/http"
|
||||
"path"
|
||||
"strings"
|
||||
|
|
@ -12,6 +13,12 @@ import (
|
|||
//go:embed all:dist
|
||||
var frontendFS embed.FS
|
||||
|
||||
func init() {
|
||||
// Register correct MIME type for SVG files
|
||||
// Go's mime package doesn't register .svg with the correct type by default
|
||||
mime.AddExtensionType(".svg", "image/svg+xml")
|
||||
}
|
||||
|
||||
// registerEmbedRoutes sets up the HTTP handler to serve the embedded frontend files
|
||||
func registerEmbedRoutes(mux *http.ServeMux) {
|
||||
// Attempt to get the subdirectory 'dist' where Vite usually builds
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue