diff --git a/pkg/attachment/attachment.go b/pkg/attachment/attachment.go index c1d333c..5890029 100644 --- a/pkg/attachment/attachment.go +++ b/pkg/attachment/attachment.go @@ -34,5 +34,6 @@ type ReuploadedAttachment struct { AttachmentReupload DownloadedSize int MXC id.ContentURIString - EncryptedFile *event.EncryptedFileInfo + // This can be nil if the room isn't encrypted. + EncryptedFile *event.EncryptedFileInfo } diff --git a/pkg/msgconv/from-discord.go b/pkg/msgconv/from-discord.go index a7119fd..a0cdcc5 100644 --- a/pkg/msgconv/from-discord.go +++ b/pkg/msgconv/from-discord.go @@ -488,9 +488,11 @@ func (mc *MessageConverter) renderDiscordLinkEmbedImage(ctx context.Context, int } preview.ImageSize = event.IntOrString(reupload.DownloadedSize) preview.ImageType = reupload.MimeType - preview.ImageEncryption = &event.EncryptedFileInfo{ - EncryptedFile: reupload.EncryptedFile.EncryptedFile, - URL: reupload.MXC, + if reupload.EncryptedFile != nil { + preview.ImageEncryption = &event.EncryptedFileInfo{ + EncryptedFile: reupload.EncryptedFile.EncryptedFile, + URL: reupload.MXC, + } } }