-
Notifications
You must be signed in to change notification settings - Fork 293
Description
There is the following in the code:
html2text/html2text/__init__.py
Line 781 in 24aac86
| assert link.attrs["title"] is not None |
Of course someone managed to produce html with links of the form <a title href="example.org">…</a> that trigger this assert. I think better than having the assert would be to replace
html2text/html2text/__init__.py
Line 780 in 24aac86
| if "title" in link.attrs: |
with
link_attrs_title = link.attrs.get("title", None)
if link_attrs_title is not None:
N.B.: The same type of pattern fixable in the way can be found on three other occasions:
html2text/html2text/__init__.py
Line 502 in 24aac86
assert attrs["src"] is not None html2text/html2text/__init__.py
Line 514 in 24aac86
assert attrs["width"] is not None html2text/html2text/__init__.py
Line 517 in 24aac86
assert attrs["height"] is not None