Skip to content

Lottie stickers arrive with no url when direct_media is disabled #255

Description

@lilithmooncohen

Bridge v0.7.7, bridge.direct_media left at its default (enabled: false).

Animated stickers arrive in Matrix as m.sticker events with no url and no file. Element Web logs Invalid file provided: cannot determine MXC URI. Has it been redacted? from prepEventContentAsMedia() and renders "Can't load this message (m.sticker)" for those events. Static PNG stickers in the same rooms bridge fine.

convertDiscordSticker in portal_convert.go:

mxc := portal.bridge.DMA.StickerMXC(sticker.ID, sticker.FormatType)
// TODO add config option to use direct media even for lottie stickers
if mxc.IsEmpty() && mime != "application/json" {
	content = portal.convertDiscordFile(ctx, "sticker", intent, sticker.ID, sticker.URL(), content)
} else {
	content.URL = mxc.CUString()
}

For a Lottie sticker (mime == "application/json") that condition is false either way: with direct media enabled mxc is not empty, and with it disabled mime is application/json. So Lottie always takes the else branch. With direct media disabled StickerMXC returns an empty ContentURI, CUString() on that is "", and URL is tagged json:"url,omitempty", so no url reaches the event. With direct media enabled the same branch instead points clients at Discord's raw Lottie .json. convertLottie is unreachable, so animated_sticker.target/args currently have no effect.

This changed in d0e3d29 (#135). v0.6.5 used portal.bridge.Config.Bridge.MediaPatterns.Sticker(sticker.ID, ext) with a plain if mxc.IsEmpty(); v0.7.0 swapped in DMA.StickerMXC() and added the mime != "application/json" clause.

The affected stickers are Lottie: resolving their IDs directly, cdn.discordapp.com/stickers/<id>.json returns application/json while the same IDs 404 on .png.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions