diff --git a/pkg/channels/pico/pico.go b/pkg/channels/pico/pico.go index 605ba724b..dbca7ad43 100644 --- a/pkg/channels/pico/pico.go +++ b/pkg/channels/pico/pico.go @@ -450,6 +450,17 @@ func picoInferAttachmentType(filename, contentType string) string { } } +func picoAllowsInlineDisplay(filename, contentType string) bool { + contentType = strings.ToLower(strings.TrimSpace(contentType)) + filename = strings.ToLower(strings.TrimSpace(filename)) + + if strings.Contains(contentType, "svg") || filepath.Ext(filename) == ".svg" { + return false + } + + return picoInferAttachmentType(filename, contentType) == "image" +} + func (c *PicoChannel) handleMediaDownload(w http.ResponseWriter, r *http.Request) { if !c.IsRunning() { http.Error(w, "channel not running", http.StatusServiceUnavailable) @@ -501,7 +512,7 @@ func (c *PicoChannel) handleMediaDownload(w http.ResponseWriter, r *http.Request } dispositionType := "attachment" - if picoInferAttachmentType(filename, contentType) == "image" { + if picoAllowsInlineDisplay(filename, contentType) { dispositionType = "inline" } diff --git a/web/frontend/vite.config.ts b/web/frontend/vite.config.ts index 57512c8b9..0de085803 100644 --- a/web/frontend/vite.config.ts +++ b/web/frontend/vite.config.ts @@ -29,6 +29,10 @@ export default defineConfig({ target: "http://localhost:18800", changeOrigin: true, }, + "/pico/media": { + target: "http://localhost:18800", + changeOrigin: true, + }, "/pico/ws": { target: "ws://localhost:18800", ws: true,