Skip to content

Commit 44c38ab

Browse files
authored
fix: in htmlization ignore html files that do not parse as html (ietf-tools#4850)
1 parent efb9f13 commit 44c38ab

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

ietf/doc/models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,10 @@ def html_body(self, classes=""):
571571
return None
572572

573573
# get body
574-
body = etree.HTML(html).xpath("//body")[0]
574+
etree_html = etree.HTML(html)
575+
if etree_html is None:
576+
return None
577+
body = etree_html.xpath("//body")[0]
575578
body.tag = "div"
576579
if classes:
577580
body.attrib["class"] = classes

0 commit comments

Comments
 (0)