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
|
AttachmentReupload
|
||||||
DownloadedSize int
|
DownloadedSize int
|
||||||
MXC id.ContentURIString
|
MXC id.ContentURIString
|
||||||
EncryptedFile *event.EncryptedFileInfo
|
// This can be nil if the room isn't encrypted.
|
||||||
|
EncryptedFile *event.EncryptedFileInfo
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -488,9 +488,11 @@ func (mc *MessageConverter) renderDiscordLinkEmbedImage(ctx context.Context, int
|
|||||||
}
|
}
|
||||||
preview.ImageSize = event.IntOrString(reupload.DownloadedSize)
|
preview.ImageSize = event.IntOrString(reupload.DownloadedSize)
|
||||||
preview.ImageType = reupload.MimeType
|
preview.ImageType = reupload.MimeType
|
||||||
preview.ImageEncryption = &event.EncryptedFileInfo{
|
if reupload.EncryptedFile != nil {
|
||||||
EncryptedFile: reupload.EncryptedFile.EncryptedFile,
|
preview.ImageEncryption = &event.EncryptedFileInfo{
|
||||||
URL: reupload.MXC,
|
EncryptedFile: reupload.EncryptedFile.EncryptedFile,
|
||||||
|
URL: reupload.MXC,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user