Pārlūkot izejas kodu

fix(html-parser): sanitize unclosed tags in markdown rendering (#14309)

tags/1.0.0
Chuckie Li pirms 8 mēnešiem
vecāks
revīzija
d5711589cd
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 5
    0
      web/app/components/base/markdown.tsx

+ 5
- 0
web/app/components/base/markdown.tsx Parādīt failu

@@ -258,6 +258,11 @@ export function Markdown(props: { content: string; className?: string }) {
if (node.type === 'element' && node.properties?.ref)
delete node.properties.ref

if (node.type === 'element' && !/^[a-z][a-z0-9]*$/i.test(node.tagName)) {
node.type = 'text'
node.value = `<${node.tagName}`
}

if (node.children)
node.children.forEach(iterate)
}

Notiek ielāde…
Atcelt
Saglabāt