mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 01:26:12 +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']),
|
||||
allowedClasses: {
|
||||
'*': [],
|
||||
'p': ['quote-inline'],
|
||||
},
|
||||
allowedAttributes: {
|
||||
a: ['href', 'rel'],
|
||||
|
||||
@@ -156,7 +156,10 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
||||
|
||||
// mainPid ok to leave as-is
|
||||
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 });
|
||||
title = sentences.shift();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user