From 13665f11c1463e83c75c594f7d54ad3a5e88b5bb Mon Sep 17 00:00:00 2001 From: Artyom Aleksyuk Date: Sun, 28 May 2017 12:59:27 +0300 Subject: [PATCH] Send a correct Content-Type for device icons --- dlna/dms/dms.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlna/dms/dms.go b/dlna/dms/dms.go index bfb2410..746dd89 100644 --- a/dlna/dms/dms.go +++ b/dlna/dms/dms.go @@ -813,6 +813,11 @@ func (server *Server) initMux(mux *http.ServeMux) { mux.HandleFunc("/debug/pprof/", pprof.Index) for i, di := range server.Icons { mux.HandleFunc(fmt.Sprintf("%s/%d", deviceIconPath, i), func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", di.Mimetype) + ext, _ := mime.ExtensionsByType(di.Mimetype) + if ext != nil && len(ext) > 0 { + w.Header().Set("Ext", strings.TrimPrefix(ext[0], ".")) + } http.ServeContent(w, r, "", time.Time{}, di.ReadSeeker) }) }