Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

$fix: show SVG attachments as downloads\n\nCo-Authored-By: QM <[email protected]> (#680)

Joshua Francef024ad8c4ba2
diff --git a/plugins/web-ui/src/ui.ts b/plugins/web-ui/src/ui.ts
index fc9fdb922..45a1a1d57 100644
--- a/plugins/web-ui/src/ui.ts
+++ b/plugins/web-ui/src/ui.ts
@@ -82,7 +82,6 @@ const RENDERABLE_IMAGE_TYPES = new Set([
"image/gif",
"image/webp",
"image/avif",
- "image/svg+xml",
"image/bmp",
"image/apng",
"image/x-icon",
diff --git a/plugins/web-ui/test/renderable-image-source.test.ts b/plugins/web-ui/test/renderable-image-source.test.ts
new file mode 100644
index 000000000..2ba8f494d
--- /dev/null
+++ b/plugins/web-ui/test/renderable-image-source.test.ts
@@ -0,0 +1,12 @@
+import { readFileSync } from "node:fs";
+import { test } from "node:test";
+import assert from "node:assert/strict";
+
+const ui = readFileSync(new URL("../src/ui.ts", import.meta.url), "utf8");
+const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
+
+test("SVG attachments fall back to a visible download chip", () => {
+ const renderableTypes = ui.match(/const RENDERABLE_IMAGE_TYPES = new Set\(\[([\s\S]*?)\]\);/)?.[1] ?? "";
+ assert.doesNotMatch(renderableTypes, /image\/svg\+xml/);
+ assert.match(chat, /if \(!browserRenderableImage\(file\.mimetype\)\) return imageChip/);
+});