Skip to content

Conversation

@deepak0x
Copy link
Contributor

@deepak0x deepak0x commented Feb 9, 2026

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 Attachment component strictly required an image_url property to render an ImageAttachment. However, App Engine payloads often provide image_type and title_link without an explicit image_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.js

  • Updated the rendering condition to treat attachments as images when:

    • image_type starts with image/, and
    • a valid title_link is present,
      even if image_url is missing.

ImageAttachment.js

  • Added fallback logic to use title_link as the image source when image_url is not available.
  • Implemented getImageUrl helper to correctly resolve absolute URLs (e.g., external storage like Google Cloud), preventing double-host prefixing issues.
  • Updated AttachmentMetadata to receive the resolved, correct URL, fixing broken download button behavior.

Screenshots

Before
Screenshot from 2026-02-09 20-09-49

After
Screenshot from 2026-02-09 20-11-55

How to Test

  1. Send a message with an attachment resembling an App Engine payload:

    • Missing image_url
    • Includes title_link
    • Includes image_type: "image/png"
  2. Verify the attachment renders as an inline image instead of a generic file card.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Images sent via App Engine are treated as generic files instead of images

1 participant