Skip to content

ValueError when making an int from empty width/height #44

@philgyford

Description

@philgyford

I don't know which site/favicon my code was trying to fetch when the final line in favicon.py generated:

File "/webapps/oohdir/code/venv/lib/python3.10/site-packages/favicon/favicon.py", line 66, in get
link_icons = tags(response.url, response.text)
File "/webapps/oohdir/code/venv/lib/python3.10/site-packages/favicon/favicon.py", line 142, in tags
width, height = dimensions(tag)
File "/webapps/oohdir/code/venv/lib/python3.10/site-packages/favicon/favicon.py", line 188, in dimensions
return int(width), int(height)
ValueError: invalid literal for int() with base 10: ''

But I've replicated the error for my tests with an HTML page that has an element like:

<link rel="icon" type="image/jpeg" sizes="x" href="/favicon.jpg" />

That sizes attribute results in the code trying to make a width/height from "" and generating the ValueError.

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