matrix-org / matrix-appservice-discord

A bridge between Matrix and Discord.
Apache License 2.0
791 stars 148 forks source link

Large videos from Discord fail to preview with M_MEDIA_TOO_LARGE #857

Open SethFalco opened 1 year ago

SethFalco commented 1 year ago

A member on Discord uploaded a 100 MB ~ video, which was bridged over to Matrix.

However, we just see a broken preview: image

If I try to download it, I get a file named like the video (including the .mov file extension) but it's only 79 bytes, and contains the following:

{"errcode":"M_TOO_LARGE","error":"Too Large","mr_errcode":"M_MEDIA_TOO_LARGE"}

If I preview the message and check the external_url, it contains the video file from Discord which I can just download and watch.

I assume it's because the file is larger than a limit set either on the bridge, homeserver, or web server. Is there a way this can be handled more gracefully, for example just send the literal Discord link as-is if the file is too large?

Message Source ```json { "content": { "body": "pokemon_waifu2x_1920x1080_2n_mov.mp4", "external_url": "https://cdn.discordapp.com/attachments/975122746528923770/1027283011978407936/pokemon_waifu2x_1920x1080_2n_mov.mp4", "info": { "h": null, "mimetype": "video/mp4", "size": 112956062, "w": null }, "msgtype": "m.video", "url": "mxc://t2bot.io/6ed64f0e1bef7e03537a15cd75aa9bf82b492b8c" }, "origin_server_ts": 1664994458034, "sender": "@_discord_197068028628828161:t2bot.io", "type": "m.room.message", "unsigned": {}, "event_id": "$FCBwx9hXxIgwf80Fg6Ot78Xwg1w3rzk-Y7mdkKgllPE", "room_id": "!nDHoYoJgPAiEooLprp:matrix.org" } ```