@@ 7,6 7,8 @@ import (
"log"
"net/http"
"strings"
+ "path/filepath"
+ "mime"
"tailscale.com/tsweb"
@@ 58,9 60,9 @@ func AssetHandler(h *Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
path := strings.TrimLeft(r.URL.Path, "/assets")
- if strings.HasSuffix(path, ".svg") {
- w.Header().Set("Content-Type", "image/svg+xml")
- }
+ if ext := mime.TypeByExtension(filepath.Ext(path)); ext != "" {
+ w.Header().Set("Content-Type", ext)
+ }
etag := r.Header.Get("If-None-Match")
_, ok := h.Cache.Files.Load(etag)