fix: Guard missing attachment, closes #1262
This commit is contained in:
@ -18,9 +18,11 @@ async function replaceImageAttachments(text) {
|
|||||||
|
|
||||||
for (const id of attachmentIds) {
|
for (const id of attachmentIds) {
|
||||||
const attachment = await Attachment.findByPk(id);
|
const attachment = await Attachment.findByPk(id);
|
||||||
|
if (attachment) {
|
||||||
const accessUrl = await getSignedImageUrl(attachment.key);
|
const accessUrl = await getSignedImageUrl(attachment.key);
|
||||||
text = text.replace(attachment.redirectUrl, accessUrl);
|
text = text.replace(attachment.redirectUrl, accessUrl);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user