mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user