فهرست منبع

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
tusooa 1 سال پیش
والد
کامیت
1d679b59a0
2فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 1 0
      changelog.d/html-attribute-parsing.fix
  2. 1 1
      src/services/html_converter/utility.service.js

+ 1 - 0
changelog.d/html-attribute-parsing.fix

@@ -0,0 +1 @@
+Fix HTML attribute parsing, discard attributes not strating with a letter

+ 1 - 1
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]