getQuoteAttachment: Handle attachments with no path

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
automated-signal 2024-09-09 17:03:39 -05:00 committed by GitHub
parent 392e18f85a
commit af94da150a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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