logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: 1d679b59a07444e18f24167cb7e8563c5e385d9f
parent b167025554ec1c1098f17d716e69f8fb0ff795f9
Author: tusooa <tusooa@kazv.moe>
Date:   Mon,  4 Sep 2023 17:26:42 +0000

Merge branch 'strip-unbalanced-attributes' into 'develop'

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

See merge request pleroma/pleroma-fe!1834

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]