Fix sending previews without images

This commit is contained in:
Fedor Indutny 2021-07-15 10:47:12 -07:00 committed by GitHub
parent c3bdf3d411
commit 668a4a5402
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,7 +78,7 @@ export type CallbackResultType = {
type PreviewType = {
url: string;
title: string;
image: AttachmentType;
image?: AttachmentType;
};
type QuoteAttachmentType = {
@ -573,7 +573,9 @@ export default class MessageSender {
const preview = await Promise.all(
(message.preview || []).map(async (item: PreviewType) => ({
...item,
image: await this.makeAttachmentPointer(item.image),
image: item.image
? await this.makeAttachmentPointer(item.image)
: undefined,
}))
);
// eslint-disable-next-line no-param-reassign