mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +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..
|
* Done so the output HTML is stripped of all non-essential items; mainly classes from plugins..
|
||||||
*/
|
*/
|
||||||
const sanitizeConfig = {
|
const sanitizeConfig = {
|
||||||
|
allowedTags: sanitize.defaults.allowedTags.concat(['img']),
|
||||||
allowedClasses: {
|
allowedClasses: {
|
||||||
'*': [],
|
'*': [],
|
||||||
},
|
},
|
||||||
@@ -286,9 +287,8 @@ Mocks.note = async (post) => {
|
|||||||
cc.add(followersUrl);
|
cc.add(followersUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
const content = await posts.getPostField(post.pid, 'content');
|
|
||||||
const { postData: parsed } = await plugins.hooks.fire('filter:parse.post', {
|
const { postData: parsed } = await plugins.hooks.fire('filter:parse.post', {
|
||||||
postData: { content },
|
postData: post,
|
||||||
type: 'activitypub.note',
|
type: 'activitypub.note',
|
||||||
});
|
});
|
||||||
post.content = sanitize(parsed.content, sanitizeConfig);
|
post.content = sanitize(parsed.content, sanitizeConfig);
|
||||||
|
|||||||
Reference in New Issue
Block a user