Skip to content

Commit

Permalink
Fix "video" embeds with missing video URLs
Browse files Browse the repository at this point in the history
Ran into an (old) message with a video embed from an unreachable website
while backfilling on a large server with a few messages from 6 years ago.
The bridge crashed before patch.

Co-authored-by: Sumner Evans <[email protected]>
  • Loading branch information
odrling and sumnerevans committed Aug 2, 2023
1 parent 5467ab0 commit 73bb634
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion portal_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).Error().Str("embed_url", embed.URL).Msg("failed to bridge media")
return &ConvertedMessage{
AttachmentID: attachmentID,
Type: event.EventMessage,
Content: &event.MessageEventContent{
Body: body,
MsgType: event.MsgNotice,
},
}
}
dbFile, err := portal.bridge.copyAttachmentToMatrix(intent, proxyURL, portal.Encrypted, NoMeta)
if err != nil {
Expand Down

0 comments on commit 73bb634

Please sign in to comment.