From 4c846332c5c972b715862df9f19b6c095c76841b Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 2 Mar 2026 09:53:08 -0800 Subject: [PATCH] fix: align handoff preview URLs with image attachment index collectUserMessageBlobPreviewUrls returns a compact array (image+blob only). Consumer now indexes by image position, not full attachment index, so blob URLs apply to the correct server attachments when some are skipped. Made-with: Cursor --- apps/web/src/components/ChatView.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 1b029584a4c5f6e09db6f571bf90846bc4e546c4..23a6c4f18666b42d0f121f7eb606231b2e6cfbee 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -710,8 +710,13 @@ export default function ChatView({ threadId }: ChatViewProps) { } let changed = false; - const attachments = message.attachments.map((attachment, index) => { - const handoffPreviewUrl = handoffPreviewUrls[index]; + let imageIndex = 0; + const attachments = message.attachments.map((attachment) => { + if (attachment.type !== "image") { + return attachment; + } + const handoffPreviewUrl = handoffPreviewUrls[imageIndex]; + imageIndex += 1; if (!handoffPreviewUrl || attachment.previewUrl === handoffPreviewUrl) { return attachment; } -- 2.54.0