genshi icon indicating copy to clipboard operation
genshi copied to clipboard

HTMLSanitizer generates non well-formed fragment for html with nested unsafe tags

Open jun66j5 opened this issue 1 year ago • 0 comments

HTMLSanitizer generates non well-formed fragment for html with nested unsafe tags.

>>> import genshi
>>> genshi.__version__
'0.7.9'
>>> from genshi.input import HTML
>>> from genshi.filters.html import HTMLSanitizer
>>> html = HTML(u'<div>111<foo>222<foo>333</foo>444</foo>555</div>')
>>> (html | HTMLSanitizer()).render()
'<div>111444</foo>555</div>'
>>> 
>>> html = HTML(u'<div>666<foo>777<foo />888</foo>999</div>')
>>> (html | HTMLSanitizer()).render()
'<div>666888</foo>999</div>'

jun66j5 avatar Mar 02 '25 22:03 jun66j5