fix regex misinterpreting tag name in badly formed HTML, prevent rich
content from ever using dangerous tags
This commit is contained in:
parent
22c3012e1c
commit
00b47e1673
2 changed files with 4 additions and 2 deletions
|
|
@ -5,7 +5,7 @@
|
|||
* @return {String} - tagname, i.e. "div"
|
||||
*/
|
||||
export const getTagName = (tag) => {
|
||||
const result = /(?:<\/(\w+)>|<(\w+)\s?.*?\/?>)/gi.exec(tag)
|
||||
const result = /(?:<\/(\w+)>|<(\w+)\s?.*?\/?>)/gis.exec(tag)
|
||||
return result && (result[1] || result[2])
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue