mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 09:56:16 +02:00
fix: filter out image attachments from remote data if they are already embedded in content
This commit is contained in:
@@ -218,6 +218,15 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
|||||||
post.toPid = urlMap.get(post.toPid);
|
post.toPid = urlMap.get(post.toPid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filter image attachments out if they are in content
|
||||||
|
const { attachment } = post._activitypub;
|
||||||
|
if (attachment && attachment.length) {
|
||||||
|
post._activitypub.attachment = attachment.filter((attachment) => {
|
||||||
|
const inContent = attachment.type === 'Image' && (post.sourceContent || post.content).includes(attachment.url);
|
||||||
|
return !inContent;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return post;
|
return post;
|
||||||
}).filter((p, idx) => !exists[idx]);
|
}).filter((p, idx) => !exists[idx]);
|
||||||
const count = unprocessed.length;
|
const count = unprocessed.length;
|
||||||
|
|||||||
Reference in New Issue
Block a user