Skip to content

handlers: upload link preview images instead of sending LINE CDN URLs - #293

Merged
iFixRobots merged 2 commits into
mainfrom
iFixRobots/link-preview-images
Oct 28, 2026
Merged

iFixRobots merged 2 commits into
mainfrom
iFixRobots/link-preview-images

Conversation

@iFixRobots

Copy link
Copy Markdown
Contributor

Link previews on incoming LINE messages show no image. ConvertText puts LINE's CDN URL straight into og:image, but MSC4095 previews need an mxc there, so clients reject it. Android logs this for every preview and retries it over and over:

E/BooperAttachmentViewModel: https://pagepoker.line-scdn.net/0hfwcQ... - attachment download error: com.beeper.chat.booper.sdk.SdkResponseException: SDK response error:  (invalid Matrix content URI) (render as permanent error: true)

This change downloads the preview image (the pagepoker CDN is public, no auth) and uploads it with intent.UploadMedia into the portal, the same way the other bridges handle preview thumbnails. In encrypted rooms that fills beeper:image:encryption. If the download fails, the preview goes out without an image instead of with a broken one. ConvertText now takes ctx, portal and intent, so its three callers pass them through.

Before After
og:image https://pagepoker.line-scdn.net/... mxc://... (or beeper:image:encryption)
Preview image in clients missing, Android retries forever shows

View in Indent
Tag @indent to continue the conversation here.

@indent indent Bot added the to be tested label Oct 28, 2026
@indent

indent Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Issues

All clear! No issues remaining. 🎉

1 issue already resolved
  • uploadPreviewImage reads the CDN response with no size cap and trusts any 200 body and the raw Content-Type header. A non-image body or a header with parameters gets uploaded as the preview image, so clients show a broken image. (fixed by commit 2a2b807)
    Found by Indent Review Agent

CI Checks

All CI checks passed on 2a2b807.

Review agents

Select any unchecked box below to run or rerun that agent.

Passed (1)
  • Indent Review Agent · No issues found in the current head.
Full results

Indent Review Agent

  • Summary: No issues found in the current head.
  • Last ran on commit: 2a2b807e
  • Latest result
    {
      "summary": "No issues found in the current head.",
      "findings": []
    }

Comment thread pkg/connector/handlers/text.go Resolved
@iFixRobots
iFixRobots requested a review from highesttt October 28, 2026 11:11

@highesttt highesttt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know how I missed that one

@iFixRobots
iFixRobots merged commit 055d62e into main Oct 28, 2026
9 checks passed
@iFixRobots
iFixRobots deleted the iFixRobots/link-preview-images branch October 28, 2026 13:59
@indent indent Bot removed the to be tested label Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants