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) <noreply@anthropic.com>
This commit is contained in:
Matt Van Horn
2026-03-14 09:02:20 -07:00
parent d114927814
commit 2ba0f5914f

View File

@@ -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);
}