From 59818031bca999adeb44ac036da19feaf945a00e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 19 Jun 2024 11:23:26 -0400 Subject: [PATCH] fix: improper sanitization and parsing in mocks.note - sanitize-html invocation was stripping out images by default, now added as an exception - only post content was passsed into filter:parse.post, but hook expects post summary --- src/activitypub/mocks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js index c8ee3b67ee..ee31833c5e 100644 --- a/src/activitypub/mocks.js +++ b/src/activitypub/mocks.js @@ -22,6 +22,7 @@ const Mocks = module.exports; * Done so the output HTML is stripped of all non-essential items; mainly classes from plugins.. */ const sanitizeConfig = { + allowedTags: sanitize.defaults.allowedTags.concat(['img']), allowedClasses: { '*': [], }, @@ -286,9 +287,8 @@ Mocks.note = async (post) => { cc.add(followersUrl); } - const content = await posts.getPostField(post.pid, 'content'); const { postData: parsed } = await plugins.hooks.fire('filter:parse.post', { - postData: { content }, + postData: post, type: 'activitypub.note', }); post.content = sanitize(parsed.content, sanitizeConfig);