Use DOMPurify to remove mx-reply

This commit is contained in:
RMidhunSuresh 2022-01-06 17:24:58 +05:30
parent cfefe6962a
commit 27a9f5dd02
2 changed files with 2 additions and 2 deletions

View file

@ -345,7 +345,6 @@ class Deserializer {
} }
export function parseHTMLBody(platform, mediaRepository, html) { export function parseHTMLBody(platform, mediaRepository, html) {
html = html.replace(/<mx-reply>.+<\/mx-reply>/s, "");
const parseResult = platform.parseHTML(html); const parseResult = platform.parseHTML(html);
const deserializer = new Deserializer(parseResult, mediaRepository); const deserializer = new Deserializer(parseResult, mediaRepository);
const parts = deserializer.parseAnyNodes(parseResult.rootNodes); const parts = deserializer.parseAnyNodes(parseResult.rootNodes);

View file

@ -56,7 +56,8 @@ class HTMLParseResult {
const sanitizeConfig = { const sanitizeConfig = {
ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|xxx|mxc):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i, ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|xxx|mxc):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i,
ADD_TAGS: ['mx-reply'] FORBID_TAGS: ['mx-reply'],
KEEP_CONTENT: false,
} }
export function parseHTML(html) { export function parseHTML(html) {