Skip to content

Commit

Permalink
Allow sends of quote attachments with no thumbnail
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Apr 21, 2023
1 parent e211837 commit bedd2c8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ts/jobs/helpers/sendNormalMessage.ts
Expand Up @@ -656,8 +656,9 @@ async function uploadMessageQuote(
}

const uploadedAttachments = await uploadQueue.addAll(
loadedQuote.attachments.map(
attachment => async (): Promise<OutgoingQuoteAttachmentType> => {
loadedQuote.attachments
.filter(attachment => attachment.thumbnail)
.map(attachment => async (): Promise<OutgoingQuoteAttachmentType> => {
const { thumbnail } = attachment;
strictAssert(thumbnail, 'Quote attachment must have a thumbnail');

Expand All @@ -668,8 +669,7 @@ async function uploadMessageQuote(
fileName: attachment.fileName,
thumbnail: uploaded,
};
}
)
})
);

// Update message with attachment digests
Expand All @@ -680,6 +680,10 @@ async function uploadMessageQuote(
const newQuote = {
...oldQuote,
attachments: oldQuote.attachments.map((attachment, index) => {
if (!attachment.thumbnail) {
return attachment;
}

strictAssert(
attachment.path === loadedQuote.attachments.at(index)?.path,
`${logId}: Quote attachment ${index} was updated from under us`
Expand Down

0 comments on commit bedd2c8

Please sign in to comment.