From d11492781420fc88c30e025524a3122f96e9005e Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Tue, 10 Mar 2026 16:50:57 -0700 Subject: [PATCH 1/2] fix: embed uploaded images inline in comments via paperclip button The paperclip button in comments uploaded images to the issue-level attachment section but didn't insert a markdown image reference into the comment body. Now it uses the imageUploadHandler to get the URL and appends an inline image to the comment text. Fixes #272 Co-Authored-By: Claude Opus 4.6 --- ui/src/components/CommentThread.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/src/components/CommentThread.tsx b/ui/src/components/CommentThread.tsx index fa123d31..0323bf88 100644 --- a/ui/src/components/CommentThread.tsx +++ b/ui/src/components/CommentThread.tsx @@ -335,10 +335,16 @@ export function CommentThread({ async function handleAttachFile(evt: ChangeEvent) { const file = evt.target.files?.[0]; - if (!file || !onAttachImage) return; + if (!file) return; setAttaching(true); try { - await onAttachImage(file); + if (imageUploadHandler) { + const url = await imageUploadHandler(file); + const markdown = `![${file.name}](${url})`; + setBody((prev) => prev ? `${prev}\n${markdown}` : markdown); + } else if (onAttachImage) { + await onAttachImage(file); + } } finally { setAttaching(false); if (attachInputRef.current) attachInputRef.current.value = ""; @@ -367,7 +373,7 @@ export function CommentThread({ contentClassName="min-h-[60px] text-sm" />
- {onAttachImage && ( + {(imageUploadHandler || onAttachImage) && (
Date: Sat, 14 Mar 2026 09:02:20 -0700 Subject: [PATCH 2/2] fix(ui): escape brackets in filename and use paragraph break for inline images Escape `[` and `]` in filenames to prevent malformed markdown when attaching images. Use `\n\n` instead of `\n` so the image renders as its own paragraph instead of inline with preceding text. Co-Authored-By: Claude Opus 4.6 (1M context) --- ui/src/components/CommentThread.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/src/components/CommentThread.tsx b/ui/src/components/CommentThread.tsx index 0323bf88..d93fa8b1 100644 --- a/ui/src/components/CommentThread.tsx +++ b/ui/src/components/CommentThread.tsx @@ -340,8 +340,9 @@ export function CommentThread({ try { if (imageUploadHandler) { const url = await imageUploadHandler(file); - const markdown = `![${file.name}](${url})`; - setBody((prev) => prev ? `${prev}\n${markdown}` : markdown); + const safeName = file.name.replace(/[[\]]/g, "\\$&"); + const markdown = `![${safeName}](${url})`; + setBody((prev) => prev ? `${prev}\n\n${markdown}` : markdown); } else if (onAttachImage) { await onAttachImage(file); }