msgconv: don't set EncryptedFile if there isn't one
FIXME: This probably isn't proper handling, but this is enough to prevent panics.
This commit is contained in:
@@ -34,5 +34,6 @@ type ReuploadedAttachment struct {
|
||||
AttachmentReupload
|
||||
DownloadedSize int
|
||||
MXC id.ContentURIString
|
||||
// This can be nil if the room isn't encrypted.
|
||||
EncryptedFile *event.EncryptedFileInfo
|
||||
}
|
||||
|
||||
@@ -488,11 +488,13 @@ func (mc *MessageConverter) renderDiscordLinkEmbedImage(ctx context.Context, int
|
||||
}
|
||||
preview.ImageSize = event.IntOrString(reupload.DownloadedSize)
|
||||
preview.ImageType = reupload.MimeType
|
||||
if reupload.EncryptedFile != nil {
|
||||
preview.ImageEncryption = &event.EncryptedFileInfo{
|
||||
EncryptedFile: reupload.EncryptedFile.EncryptedFile,
|
||||
URL: reupload.MXC,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (mc *MessageConverter) renderDiscordLinkEmbed(ctx context.Context, intent bridgev2.MatrixAPI, portal *bridgev2.Portal, embed *discordgo.MessageEmbed) *event.BeeperLinkPreview {
|
||||
var preview event.BeeperLinkPreview
|
||||
|
||||
Reference in New Issue
Block a user