msgconv: correctly bridge attachments and embeds

`URL` needs to be set if the room/attachment is unencrypted; otherwise,
`File` needs to be set.
This commit is contained in:
Skip R
2026-01-14 17:52:06 -08:00
parent bdbfd661a2
commit ac338ee722

View File

@@ -289,7 +289,11 @@ func (mc *MessageConverter) renderDiscordVideoEmbed(ctx context.Context, intent
MimeType: reupload.MimeType, MimeType: reupload.MimeType,
Size: reupload.DownloadedSize, Size: reupload.DownloadedSize,
}, },
File: reupload.EncryptedFile, }
if reupload.EncryptedFile != nil {
content.File = reupload.EncryptedFile
} else {
content.URL = reupload.MXC
} }
if embed.Video != nil { if embed.Video != nil {
@@ -570,8 +574,11 @@ func (mc *MessageConverter) renderDiscordAttachment(ctx context.Context, intent
content.Info.Width = att.Width content.Info.Width = att.Width
content.Info.Height = att.Height content.Info.Height = att.Height
} }
content.URL = reupload.MXC if reupload.EncryptedFile != nil {
content.File = reupload.EncryptedFile content.File = reupload.EncryptedFile
} else {
content.URL = reupload.MXC
}
return &bridgev2.ConvertedMessagePart{ return &bridgev2.ConvertedMessagePart{
Type: event.EventMessage, Type: event.EventMessage,