Skip to content

Some files appear as 0KB going from Discord to Matrix due to lack of "info": {"size": whateverint} in Matrix message #187

@SwirlyStone5877

Description

@SwirlyStone5877

Describe the bug
When some files send from Discord to Matrix, the size appears as 0KB on Cinny and doesn't embed (however downloads fine).

To Reproduce
Steps to reproduce the behavior:

  1. send a video file (.mp4 tested, but not .mov??) on Discord
  2. watch it not embed on Cinny (Matrix client)

Expected behavior
It should have the proper size and therefore embed in Cinny.

Screenshots/debug logs
Image
Image

[0011] DEBUG discord:      [messageCreate:bridge/discord/handlers.go:144] == Receiving event &discordgo.Message{ID:"1479555149172179157", ChannelID:"688870697107194100", GuildID:"688870695974731894", Content:"", Timestamp:time.Date(2026, time.March, 6, 19, 3, 56, 368000000, time.Location("")), EditedTimestamp:<nil>, MentionRoles:[]string{}, TTS:false, MentionEveryone:false, Author:(*discordgo.User)(0x7f4b7516c0), Attachments:[]*discordgo.MessageAttachment{(*discordgo.MessageAttachment)(0x7f4b434070)}, Components:[]discordgo.MessageComponent{}, Embeds:[]*discordgo.MessageEmbed{}, Mentions:[]*discordgo.User{}, Reactions:[]*discordgo.MessageReactions(nil), Pinned:false, Type:0, WebhookID:"", Member:(*discordgo.Member)(0x7f4b763900), MentionChannels:[]*discordgo.Channel(nil), Activity:(*discordgo.MessageActivity)(nil), Application:(*discordgo.MessageApplication)(nil), MessageReference:(*discordgo.MessageReference)(nil), ReferencedMessage:(*discordgo.Message)(nil), Interaction:(*discordgo.MessageInteraction)(nil), Flags:0, Thread:(*discordgo.Channel)(nil), StickerItems:[]*discordgo.StickerItem(nil)}
[0011] DEBUG discord:      [HttpGetBytes:bridge/bridge.go:194] Getting HTTP bytes with request: &http.Request{Method:"GET", URL:(*url.URL)(0x7f4b746240), Proto:"HTTP/1.1", ProtoMajor:1, ProtoMinor:1, Header:http.Header{}, Body:io.ReadCloser(nil), GetBody:(func() (io.ReadCloser, error))(nil), ContentLength:0, TransferEncoding:[]string(nil), Close:false, Host:"cdn.discordapp.com", Form:url.Values(nil), PostForm:url.Values(nil), MultipartForm:(*multipart.Form)(nil), Trailer:http.Header(nil), RemoteAddr:"", RequestURI:"", TLS:(*tls.ConnectionState)(nil), Cancel:(<-chan struct {})(nil), Response:(*http.Response)(nil), Pattern:"", ctx:context.backgroundCtx{emptyCtx:context.emptyCtx{}}, pat:(*http.pattern)(nil), matches:[]string(nil), otherValues:map[string]string(nil)}
[0012] DEBUG discord:      [addAttachmentProcess:bridge/bridge.go:393] Download OK "eyedbarls.mp4" 666906
[0012] DEBUG discord:      [func1:bridge/discord/handlers.go:228] <= Sending message attachments from architectnt on discord.mydiscord to gateway
[0012] DEBUG discord:      [func1:bridge/discord/handlers.go:229] <= Message is config.Message{Text:"", Channel:"💬〉general", Username:"archie", UserID:"243948128586301440", Avatar:"https://cdn.discordapp.com/avatars/243948128586301440/a_2f4ec55c56850913a037ee0711757759.jpg", Account:"discord.mydiscord", Event:"", Protocol:"", Gateway:"", ParentID:"", Timestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), ID:"1479555149172179157", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"eyedbarls.mp4", Data:(*[]uint8)(0x7f4b53c3a8), Comment:"", URL:"https://cdn.discordapp.com/attachments/688870697107194100/1479555148954079272/eyedbarls.mp4?ex=69ac769c&is=69ab251c&hm=f50e5c0d674772258d7fca7c224e5e01772c5be677d0aa64ad138043327f7ae8&", Size:666906, Avatar:false, SHA:"", NativeID:"1479555148954079272"}}}}
[0012] DEBUG gateway:      [SendMessage:gateway/gateway.go:513] => Sending config.Message{Text:"", Channel:"💬〉general", Username:"archie", UserID:"243948128586301440", Avatar:"https://cdn.discordapp.com/avatars/243948128586301440/a_2f4ec55c56850913a037ee0711757759.jpg", Account:"discord.mydiscord", Event:"", Protocol:"discord", Gateway:"general", ParentID:"", Timestamp:time.Date(2026, time.March, 6, 11, 3, 57, 248642534, time.Local), ID:"1479555149172179157", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"eyedbarls.mp4", Data:(*[]uint8)(0x7f4b53c3a8), Comment:"", URL:"https://cdn.discordapp.com/attachments/688870697107194100/1479555148954079272/eyedbarls.mp4?ex=69ac769c&is=69ab251c&hm=f50e5c0d674772258d7fca7c224e5e01772c5be677d0aa64ad138043327f7ae8&", Size:666906, Avatar:false, SHA:"", NativeID:"1479555148954079272"}}}} from discord.mydiscord (💬〉general) to matrix.mymatrix (!slSahYKYUjOryzVAwy:architectenterprises.net)
[0012] DEBUG matrix:       [Send:bridge/matrix/matrix.go:178] => Receiving config.Message{Text:"", Channel:"!slSahYKYUjOryzVAwy:architectenterprises.net", Username:"「archie > <b><i>discord</i></b> 」<br>", UserID:"243948128586301440", Avatar:"https://cdn.discordapp.com/avatars/243948128586301440/a_2f4ec55c56850913a037ee0711757759.jpg", Account:"discord.mydiscord", Event:"", Protocol:"discord", Gateway:"general", ParentID:"", Timestamp:time.Date(2026, time.March, 6, 11, 3, 57, 248642534, time.Local), ID:"", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"eyedbarls.mp4", Data:(*[]uint8)(0x7f4b53c3a8), Comment:"", URL:"https://cdn.discordapp.com/attachments/688870697107194100/1479555148954079272/eyedbarls.mp4?ex=69ac769c&is=69ab251c&hm=f50e5c0d674772258d7fca7c224e5e01772c5be677d0aa64ad138043327f7ae8&", Size:666906, Avatar:false, SHA:"", NativeID:"1479555148954079272"}}}}
[0012] DEBUG matrix:       [Send:bridge/matrix/matrix.go:181] Channel !slSahYKYUjOryzVAwy:architectenterprises.net maps to channel id !slSahYKYUjOryzVAwy:architectenterprises.net
[0012] DEBUG matrix:       [handleUploadFile:bridge/matrix/matrix.go:881] uploading file: eyedbarls.mp4 video/mp4
[0012] DEBUG matrix:       [handleMessageEvent:bridge/matrix/matrix.go:666] == Receiving message event: &event.Event{StateKey:(*string)(nil), Sender:"@kaizobridge:architectenterprises.net", Type:event.Type{Type:"m.room.message", Class:1}, Timestamp:1772823837267, ID:"$lJIvg9JsU7S2LPVKfjS9VKHtKeMqB77Xo7yC2QzKhhA", RoomID:"!slSahYKYUjOryzVAwy:architectenterprises.net", Content:event.Content{VeryRaw:json.RawMessage{0x7b, 0x22, 0x6d, 0x73, 0x67, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6d, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x2c, 0x22, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x3a, 0x22, 0x5c, 0x75, 0x33, 0x30, 0x30, 0x63, 0x61, 0x72, 0x63, 0x68, 0x69, 0x65, 0x20, 0x3e, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x20, 0x5c, 0x75, 0x33, 0x30, 0x30, 0x64, 0x22, 0x2c, 0x22, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x3a, 0x22, 0x6f, 0x72, 0x67, 0x2e, 0x6d, 0x61, 0x74, 0x72, 0x69, 0x78, 0x2e, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x2c, 0x22, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x64, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x3a, 0x22, 0x5c, 0x75, 0x33, 0x30, 0x30, 0x63, 0x61, 0x72, 0x63, 0x68, 0x69, 0x65, 0x20, 0x3e, 0x20, 0x3c, 0x62, 0x3e, 0x3c, 0x69, 0x3e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x72, 0x64, 0x3c, 0x2f, 0x69, 0x3e, 0x3c, 0x2f, 0x62, 0x3e, 0x20, 0x5c, 0x75, 0x33, 0x30, 0x30, 0x64, 0x3c, 0x62, 0x72, 0x3e, 0x22, 0x7d}, Raw:map[string]interface {}{"body":"「archie > discord 」", "format":"org.matrix.custom.html", "formatted_body":"「archie > <b><i>discord</i></b> 」<br>", "msgtype":"m.text"}, Parsed:(*event.MessageEventContent)(0x7f4af7e580)}, Redacts:"", Unsigned:event.Unsigned{PrevContent:(*event.Content)(nil), PrevSender:"", Membership:"join", ReplacesState:"", Age:31, TransactionID:"mautrix-go_1772823837249496578_1", Relations:(*event.Relations)(nil), RedactedBecause:(*event.Event)(nil), InviteRoomState:[]*event.Event(nil), BeeperHSOrder:0, BeeperHSSuborder:0, BeeperHSOrderString:(*event.BeeperEncodedOrder)(nil), BeeperFromBackup:false, ElementSoftFailed:false, ElementPolicyServerSpammy:false}, Mautrix:event.MautrixInfo{EventSource:34, TrustState:0, ForwardedKeys:false, WasEncrypted:false, TrustSource:(*id.Device)(nil), ReceivedAt:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), EditedAt:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), LastEditID:"", DecryptionDuration:0, CheckpointSent:false, IgnoreState:false}, ToUserID:"", ToDeviceID:""}
[0013] DEBUG matrix:       [handleUploadFile:bridge/matrix/matrix.go:906] sendVideo mxc://architectenterprises.net/qrVibXKhsAgOOhcCAaWPrlJM
[0013] DEBUG matrix:       [handleUploadFile:bridge/matrix/matrix.go:972] result: &mautrix.RespMediaUpload{ContentURI:id.ContentURI{Homeserver:"architectenterprises.net", FileID:"qrVibXKhsAgOOhcCAaWPrlJM"}}
[0013] DEBUG gateway:      [func1:gateway/gateway.go:522] => Send from discord.mydiscord (💬〉general) to matrix.mymatrix (!slSahYKYUjOryzVAwy:architectenterprises.net) took 770.734923ms
[0013] DEBUG matrix:       [handleMessageEvent:bridge/matrix/matrix.go:666] == Receiving message event: &event.Event{StateKey:(*string)(nil), Sender:"@kaizobridge:architectenterprises.net", Type:event.Type{Type:"m.room.message", Class:1}, Timestamp:1772823837975, ID:"$28z3ImvBsloKQxVH50DSrVGX6mjIUzB8UADSYbuaJ5w", RoomID:"!slSahYKYUjOryzVAwy:architectenterprises.net", Content:event.Content{VeryRaw:json.RawMessage{0x7b, 0x22, 0x6d, 0x73, 0x67, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6d, 0x2e, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x22, 0x2c, 0x22, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x3a, 0x22, 0x22, 0x2c, 0x22, 0x75, 0x72, 0x6c, 0x22, 0x3a, 0x22, 0x6d, 0x78, 0x63, 0x3a, 0x2f, 0x2f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x74, 0x65, 0x63, 0x74, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x73, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x71, 0x72, 0x56, 0x69, 0x62, 0x58, 0x4b, 0x68, 0x73, 0x41, 0x67, 0x4f, 0x4f, 0x68, 0x63, 0x43, 0x41, 0x61, 0x57, 0x50, 0x72, 0x6c, 0x4a, 0x4d, 0x22, 0x2c, 0x22, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x22, 0x65, 0x79, 0x65, 0x64, 0x62, 0x61, 0x72, 0x6c, 0x73, 0x2e, 0x6d, 0x70, 0x34, 0x22, 0x7d}, Raw:map[string]interface {}{"body":"", "filename":"eyedbarls.mp4", "msgtype":"m.video", "url":"mxc://architectenterprises.net/qrVibXKhsAgOOhcCAaWPrlJM"}, Parsed:(*event.MessageEventContent)(0x7f4b7fa000)}, Redacts:"", Unsigned:event.Unsigned{PrevContent:(*event.Content)(nil), PrevSender:"", Membership:"join", ReplacesState:"", Age:35, TransactionID:"mautrix-go_1772823837947916791_2", Relations:(*event.Relations)(nil), RedactedBecause:(*event.Event)(nil), InviteRoomState:[]*event.Event(nil), BeeperHSOrder:0, BeeperHSSuborder:0, BeeperHSOrderString:(*event.BeeperEncodedOrder)(nil), BeeperFromBackup:false, ElementSoftFailed:false, ElementPolicyServerSpammy:false}, Mautrix:event.MautrixInfo{EventSource:34, TrustState:0, ForwardedKeys:false, WasEncrypted:false, TrustSource:(*id.Device)(nil), ReceivedAt:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), EditedAt:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), LastEditID:"", DecryptionDuration:0, CheckpointSent:false, IgnoreState:false}, ToUserID:"", ToDeviceID:""}

Environment (please complete the following information):

  • OS: Alpine Linux (aarch64) on bridge hoster's end
  • Matterbridge version: version: 1.26.1-dev
  • If self compiled: e7fc6f8338db15d85904f4fb0ae2dd54fc8a8723

Additional context
Config file: https://wdlite.architectenterprises.net/matterbridge.toml

Raw data for 0KB file:

{
  "type": "m.room.message",
  "sender": "@kaizobridge:architectenterprises.net",
  "content": {
    "msgtype": "m.video",
    "body": "",
    "url": "mxc://architectenterprises.net/aQhjgstfURUVuIMFHWlerFBo",
    "filename": "1305310541748637736_1.mp4"
  },
  "origin_server_ts": 1772825832242,
  "unsigned": {
    "membership": "join",
    "age": 45
  },
  "event_id": "$6QB6A4uXOsDr3LNoIDb-24lF8gbhBOC1yp28tmosEl4",
  "room_id": "!slSahYKYUjOryzVAwy:architectenterprises.net"
}

As you can see it is missing an "info": {} with a "size": int inside.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions