Skip to content

None link title assert hit #326

@equaeghe

Description

@equaeghe

There is the following in the code:

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

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions