Check validity of link previews on import

This commit is contained in:
trevor-signal
2025-01-16 11:28:53 -05:00
committed by GitHub
parent 7e1a76ede8
commit 423a92df4d
6 changed files with 175 additions and 42 deletions

View File

@@ -516,19 +516,12 @@ export async function handleDataMessage(
};
}
if (!item.image && !item.title) {
return null;
}
// Story link previews don't have to correspond to links in the
// message body.
if (isStory(message.attributes)) {
return item;
}
if (
!urls.includes(item.url) ||
!LinkPreview.shouldPreviewHref(item.url)
!LinkPreview.isValidLinkPreview(urls, item, {
isStory: isStory(message.attributes),
})
) {
return undefined;
return null;
}
return item;