Fix: Render App Engine image attachments correctly #1143
+43
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where image attachments sent via the Rocket.Chat App Engine were rendered as generic file attachments instead of inline images.
The issue occurred because the
Attachmentcomponent strictly required animage_urlproperty to render anImageAttachment. However, App Engine payloads often provideimage_typeandtitle_linkwithout an explicitimage_url, causing valid image attachments to fall back to the generic file view.Additionally, this PR fixes broken image links and non-functional download buttons for these attachments by correctly handling absolute URLs.
Closes #1140
Changes
Attachment.jsUpdated the rendering condition to treat attachments as images when:
image_typestarts withimage/, andtitle_linkis present,even if
image_urlis missing.ImageAttachment.jstitle_linkas the image source whenimage_urlis not available.getImageUrlhelper to correctly resolve absolute URLs (e.g., external storage like Google Cloud), preventing double-host prefixing issues.AttachmentMetadatato receive the resolved, correct URL, fixing broken download button behavior.Screenshots
Before

After

How to Test
Send a message with an attachment resembling an App Engine payload:
image_urltitle_linkimage_type: "image/png"Verify the attachment renders as an inline image instead of a generic file card.