mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-23 12:31:21 +02:00
fix: allow quote-inline class in mocks sanitizer so quote-post fallback elements can be detected and removed during title generation, fixes #13688
This commit is contained in:
@@ -33,6 +33,7 @@ const sanitizeConfig = {
|
|||||||
allowedTags: sanitize.defaults.allowedTags.concat(['img', 'picture', 'source']),
|
allowedTags: sanitize.defaults.allowedTags.concat(['img', 'picture', 'source']),
|
||||||
allowedClasses: {
|
allowedClasses: {
|
||||||
'*': [],
|
'*': [],
|
||||||
|
'p': ['quote-inline'],
|
||||||
},
|
},
|
||||||
allowedAttributes: {
|
allowedAttributes: {
|
||||||
a: ['href', 'rel'],
|
a: ['href', 'rel'],
|
||||||
|
|||||||
@@ -156,7 +156,10 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
|||||||
|
|
||||||
// mainPid ok to leave as-is
|
// mainPid ok to leave as-is
|
||||||
if (!title) {
|
if (!title) {
|
||||||
const prettified = pretty(content || sourceContent);
|
let prettified = pretty(content || sourceContent);
|
||||||
|
|
||||||
|
// Remove any lines that contain quote-post fallbacks
|
||||||
|
prettified = prettified.split('\n').filter(line => !line.startsWith('<p class="quote-inline"')).join('\'n');
|
||||||
const sentences = tokenizer.sentences(prettified, { sanitize: true, newline_boundaries: true });
|
const sentences = tokenizer.sentences(prettified, { sanitize: true, newline_boundaries: true });
|
||||||
title = sentences.shift();
|
title = sentences.shift();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user