From 06a1087fef0a97af300ea511fd38e58453044582 Mon Sep 17 00:00:00 2001 From: Deepak Bhagat Date: Mon, 9 Feb 2026 20:30:25 +0530 Subject: [PATCH] Fix: Render App Engine image attachments correctly --- .../src/views/AttachmentHandler/Attachment.js | 6 ++- .../AttachmentHandler/ImageAttachment.js | 48 +++++++++++++++---- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/packages/react/src/views/AttachmentHandler/Attachment.js b/packages/react/src/views/AttachmentHandler/Attachment.js index 20c329138d..379e2e251e 100644 --- a/packages/react/src/views/AttachmentHandler/Attachment.js +++ b/packages/react/src/views/AttachmentHandler/Attachment.js @@ -32,7 +32,11 @@ const Attachment = ({ attachment, host, type, variantStyles = {}, msg }) => { /> ); } - if (attachment && attachment.image_url) { + if ( + attachment && + (attachment.image_url || + (attachment.image_type?.startsWith('image/') && attachment.title_link)) + ) { return ( !prevState); }; + const getImageUrl = (url) => { + if (!url) { + return; + } + if (url.startsWith('http') || url.startsWith('//')) { + return url; + } + return `${host}${url}`; + }; + return ( {isExpanded && ( - setShowGallery(true)}> + + extractIdFromUrl(attachment.title_link) + ? setShowGallery(true) + : null + } + style={{ + cursor: extractIdFromUrl(attachment.title_link) + ? 'pointer' + : 'default', + }} + > ( setShowGallery(true)} + onClick={() => + extractIdFromUrl(nestedAttachment.title_link) + ? setShowGallery(true) + : null + } css={[ css` - cursor: pointer; + cursor: ${extractIdFromUrl(nestedAttachment.title_link) + ? 'pointer' + : 'default'}; border-radius: inherit; line-height: 0; padding: 0.5rem; @@ -153,14 +180,15 @@ const ImageAttachment = ({ )}