Skip to content
Snippets Groups Projects
Commit 1d679b59 authored by tusooa's avatar tusooa :zap:
Browse files

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
parents b1670255 9baffbfb
No related branches found
No related tags found
2 merge requests!1861Update master branch,!1834Fix HTML attribute parsing, discard attributes not strating with a letter
Pipeline #45894 passed
Fix HTML attribute parsing, discard attributes not strating with a letter
......@@ -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]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment