Skip to content

fix(web): correct SVG MIME type to image/svg+xml#1429

Merged
wj-xiao merged 1 commit intosipeed:mainfrom
darrenzeng2025:fix/svg-mime-type
Mar 13, 2026
Merged

fix(web): correct SVG MIME type to image/svg+xml#1429
wj-xiao merged 1 commit intosipeed:mainfrom
darrenzeng2025:fix/svg-mime-type

Conversation

@darrenzeng2025
Copy link
Contributor

Summary

Fixes #1410

Go's built-in "mime.TypeByExtension" returns "image/svg" for .svg files, but the correct MIME type per RFC 6838 is "image/svg+xml". This PR registers the correct MIME type when setting up the static file server.

Changes

  • Added "mime" package import to web/backend/embed.go
  • Added mime.AddExtensionType(".svg", "image/svg+xml") call at the beginning of registerEmbedRoutes()
  • Added error handling with warning log if registration fails

Test plan

  • Build the web backend: go build ./web/backend/
  • Verify SVG files are served with Content-Type: image/svg+xml

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

Go's built-in mime.TypeByExtension returns 'image/svg' for .svg files,
but the correct MIME type per RFC 6838 is 'image/svg+xml'. This fix
registers the correct MIME type when setting up the static file server.

Fixes sipeed#1410
@sipeed-bot sipeed-bot bot added type: bug Something isn't working go Pull requests that update go code labels Mar 12, 2026
@wj-xiao wj-xiao merged commit c508d6f into sipeed:main Mar 13, 2026
4 checks passed
@Orgmar
Copy link
Contributor

Orgmar commented Mar 13, 2026

@darrenzeng2025 Good catch on the SVG MIME type issue. Go's built-in mime package returning image/svg instead of image/svg+xml is one of those subtle bugs that can cause real headaches with browser rendering. Clean fix with the error handling too.

We're building a PicoClaw Dev Group on Discord for contributors. If you'd like to join, send an email to [email protected] with the subject [Join PicoClaw Dev Group] + your GitHub account and we'll send you the Discord invite link!

dj-oyu pushed a commit to dj-oyu/picoclaw that referenced this pull request Mar 14, 2026
fix(web): correct SVG MIME type to image/svg+xml
dj-oyu pushed a commit to dj-oyu/picoclaw that referenced this pull request Mar 16, 2026
fix(web): correct SVG MIME type to image/svg+xml
j0904 pushed a commit to j0904/picoclaw that referenced this pull request Mar 22, 2026
fix(web): correct SVG MIME type to image/svg+xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update go code type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] SVG files served with incorrect MIME type (image/svg instead of image/svg+xml)

3 participants