Alir3z4 / Alir3z4/html2text

`None` link title assert hit

Offen
#326 10 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
2.2k
Forks
296
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

There is the following in the code:

https://github.com/Alir3z4/html2text/blob/24aac8629f6a50ab262727815107384e0682cf42/html2text/__init__.py#L781

Of course someone managed to produce html with links of the form `` that trigger this assert. I think better than having the assert would be to replace

https://github.com/Alir3z4/html2text/blob/24aac8629f6a50ab262727815107384e0682cf42/html2text/__init__.py#L780

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:
* https://github.com/Alir3z4/html2text/blob/24aac8629f6a50ab262727815107384e0682cf42/html2text/__init__.py#L502
* https://github.com/Alir3z4/html2text/blob/24aac8629f6a50ab262727815107384e0682cf42/html2text/__init__.py#L514
* https://github.com/Alir3z4/html2text/blob/24aac8629f6a50ab262727815107384e0682cf42/html2text/__init__.py#L517

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.