Skip to content

stickers: bridge LINE stickers as m.sticker at LINE's display size - #273

Open
iFixRobots wants to merge 1 commit into
mainfrom
sticker-display-size
Open

iFixRobots wants to merge 1 commit into
mainfrom
sticker-display-size

Conversation

@iFixRobots

Copy link
Copy Markdown
Contributor

LINE stickers were bridged as m.image with no info.w/info.h, so clients used their default image size. Beeper Desktop renders an image without dimensions 400 px tall, so a sticker LINE shows at 185×150 shows up about 2.7× larger.

This sends stickers as m.sticker with dimensions, the same way the WhatsApp (190 px) and Signal (200 px) bridges do. The size is LINE's own display size. The CDN serves each sticker as an Android asset at 0.75× the original and as PC and iPhone @1x assets at 0.5×, so the display size is 2/3 of the Android file we already download. For example, sticker 52002734 is 278×225 on Android and 185×150 on PC. The other stickers I checked also matched to the pixel.

Since bridged stickers are now m.sticker, the room features advertise sticker support, and Matrix stickers go out to LINE as images. That keeps forwarding a bridged sticker working, because iOS checks file[m.sticker] before allowing a forward. The capabilities ID is bumped.

go build, go vet and the existing connector tests pass.

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

Stickers were sent as m.image with no dimensions, so clients fell back to
their default image size (Desktop renders them 400 px tall). Send them as
m.sticker with width/height set to LINE's PC/@1x size (2/3 of the Android
asset we download). Advertise sticker support and send Matrix stickers to
LINE as images so forwarding a bridged sticker keeps working.
@indent

indent Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Issues

1 potential issue found:

  • Matrix stickers sent without info now pass the new sticker capability check and hit a nil dereference on msg.Content.Info.MimeType in the image send path. Guard the nil Info and fall back to content sniffing.
    Found by Indent Review Agent

↑ Select any checkbox above to have Indent auto-fix the issue

CI Checks

All CI checks passed on 2746f57.

Review agents

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

Found issues (1)
  • Indent Review Agent · One nit: nil Info deref for info-less stickers
Full results

Indent Review Agent

  • Summary: One nit: nil Info deref for info-less stickers
  • Last ran on commit: 2746f57d
  • Latest result
    {
      "summary": "One nit: nil Info deref for info-less stickers",
      "findings": [
        {
          "fix": "Guard the dereference, for example `mimeType := \"\"; if msg.Content.Info != nil { mimeType = msg.Content.Info.MimeType }`, and fall back to `http.DetectContentType(data)` when it's empty.",
          "line": 198,
          "path": "pkg/connector/send_message.go",
          "issue": "Before this PR, m.sticker events had no CapMsgSticker entry in the room features, so bridgev2's checkMessageContentCaps rejected them with ErrUnsupportedMessageType. Now they pass the caps check (bridgev2 skips the mime and size checks when Info is nil) and get mapped to MsgImage. The image branch then reads `msg.Content.Info.MimeType` without a nil check. A sticker event without `info` (the spec requires it, but some clients and bots leave it out) panics here instead of failing cleanly. MsgImage already had the same exposure; this PR adds a new way to hit it.",
          "title": "Matrix stickers with no `info` now reach a nil dereference",
          "severity": "nit"
        }
      ]
    }

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