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
This commit is contained in:
Julian Lam
2024-06-19 11:23:26 -04:00
parent 5a2fa52ccc
commit 59818031bc

View File

@@ -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);