From 2c396e553eb24ad50b7edba0655d2869b784b1ad Mon Sep 17 00:00:00 2001 From: Florian Badie Date: Fri, 1 Sep 2023 08:22:53 +0000 Subject: [PATCH] Fix "video" embeds with missing video URLs (#110) --- portal_convert.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/portal_convert.go b/portal_convert.go index aa0d729..3d34005 100644 --- a/portal_convert.go +++ b/portal_convert.go @@ -201,8 +201,18 @@ func (portal *Portal) convertDiscordVideoEmbed(ctx context.Context, intent *apps var proxyURL string if embed.Video != nil { proxyURL = embed.Video.ProxyURL - } else { + } else if embed.Thumbnail != nil { proxyURL = embed.Thumbnail.ProxyURL + } else { + zerolog.Ctx(ctx).Warn().Str("embed_url", embed.URL).Msg("No video or thumbnail proxy URL found in embed") + return &ConvertedMessage{ + AttachmentID: attachmentID, + Type: event.EventMessage, + Content: &event.MessageEventContent{ + Body: "Failed to bridge media: no video or thumbnail proxy URL found in embed", + MsgType: event.MsgNotice, + }, + } } dbFile, err := portal.bridge.copyAttachmentToMatrix(intent, proxyURL, portal.Encrypted, NoMeta) if err != nil {