mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-16 07:25:59 +08:00
fix(html-parser): sanitize unclosed tags in markdown rendering (#14309)
This commit is contained in:
parent
375a359c97
commit
d5711589cd
@ -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…
x
Reference in New Issue
Block a user