diff options
| author | tusooa <tusooa@kazv.moe> | 2023-09-04 17:26:42 +0000 |
|---|---|---|
| committer | tusooa <tusooa@kazv.moe> | 2023-09-04 17:26:42 +0000 |
| commit | 1d679b59a07444e18f24167cb7e8563c5e385d9f (patch) | |
| tree | 0dcb989ae5bb48a53e1b0455a5133bd0256ca28f | |
| parent | b167025554ec1c1098f17d716e69f8fb0ff795f9 (diff) | |
| parent | 9baffbfbdeaaf52be95112c519e31ef5f2408180 (diff) | |
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
| -rw-r--r-- | changelog.d/html-attribute-parsing.fix | 1 | ||||
| -rw-r--r-- | src/services/html_converter/utility.service.js | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/changelog.d/html-attribute-parsing.fix b/changelog.d/html-attribute-parsing.fix new file mode 100644 index 00000000..0952f773 --- /dev/null +++ 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 index a1301353..f8e62dfe 100644 --- 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] |
