瀏覽代碼

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

tags/1.0.0
Chuckie Li 8 月之前
父節點
當前提交
d5711589cd
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 5 行新增0 行删除
  1. 5
    0
      web/app/components/base/markdown.tsx

+ 5
- 0
web/app/components/base/markdown.tsx 查看文件

@@ -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)
}

Loading…
取消
儲存