Skip to content

Node.js based forum software built for the modern web

fix: improper sanitization and parsing in mocks.note

Julian Lam59818031bca9
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);