getQuoteAttachment: Handle attachments with no path

This commit is contained in:
Scott Nonnenberg 2024-09-07 02:21:31 +10:00 committed by GitHub
parent ec0c4861a7
commit 5f82c82803
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -80,14 +80,13 @@ export async function getQuoteAttachment(
return {
contentType: isGIFQuote ? IMAGE_GIF : contentType,
fileName,
thumbnail: thumbnail
? {
...(await loadAttachmentData(thumbnail)),
objectUrl: thumbnail.path
? getLocalAttachmentUrl(thumbnail)
: undefined,
}
: undefined,
thumbnail:
thumbnail && thumbnail.path
? {
...(await loadAttachmentData(thumbnail)),
objectUrl: getLocalAttachmentUrl(thumbnail),
}
: undefined,
};
})
);
@ -103,14 +102,13 @@ export async function getQuoteAttachment(
return {
contentType,
thumbnail: image
? {
...(await loadAttachmentData(image)),
objectUrl: image.path
? getLocalAttachmentUrl(image)
: undefined,
}
: undefined,
thumbnail:
image && image.path
? {
...(await loadAttachmentData(image)),
objectUrl: getLocalAttachmentUrl(image),
}
: undefined,
};
})
);
@ -122,10 +120,12 @@ export async function getQuoteAttachment(
return [
{
contentType,
thumbnail: {
...(await loadAttachmentData(sticker.data)),
objectUrl: path ? getLocalAttachmentUrl(sticker.data) : undefined,
},
thumbnail: path
? {
...(await loadAttachmentData(sticker.data)),
objectUrl: getLocalAttachmentUrl(sticker.data),
}
: undefined,
},
];
}