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:
Skip R
2026-01-13 14:49:01 -08:00
parent 3d59a0eb3f
commit bdbfd661a2
2 changed files with 7 additions and 4 deletions

View File

@@ -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
} }

View File

@@ -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,
}
} }
} }