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