logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: 9baffbfbdeaaf52be95112c519e31ef5f2408180
parent a1641193b5b7c72e919b9848b167bc4d4a40444b
Author: Alexander Tumin <iamtakingiteasy@eientei.org>
Date:   Wed, 31 May 2023 00:25:10 +0300

Fix HTML attribute parsing, discard attributes not strating with a letter

Diffstat:

Achangelog.d/html-attribute-parsing.fix1+
Msrc/services/html_converter/utility.service.js2+-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/changelog.d/html-attribute-parsing.fix b/changelog.d/html-attribute-parsing.fix @@ -0,0 +1 @@ +Fix HTML attribute parsing, discard attributes not strating with a letter diff --git a/src/services/html_converter/utility.service.js b/src/services/html_converter/utility.service.js @@ -22,7 +22,7 @@ export const getAttrs = (tag, filter) => { .replace(new RegExp('^' + getTagName(tag)), '') .replace(/\/?$/, '') .trim() - const attrs = Array.from(innertag.matchAll(/([a-z0-9-]+)(?:=("[^"]+?"|'[^']+?'))?/gi)) + const attrs = Array.from(innertag.matchAll(/([a-z]+[a-z0-9-]*)(?:=("[^"]+?"|'[^']+?'))?/gi)) .map(([trash, key, value]) => [key, value]) .map(([k, v]) => { if (!v) return [k, true]