Closed philipsorensen closed 4 months ago
Hey @philipsorensen! Thanks for the PR to fix this bug. I've just made a slight change to your approach to fix a potential bug that might have been introduced.
For example, say we have this HTML:
<head>
<meta charset="utf-8" />
<title>Dummy title</title>
<meta name="title" content="Dummy title">
<meta name="description" content="Dummy title">
<link rel="icon" type="image/x-icon">
<link rel="icon" type="image/png" sizes="96x96" href=/favicon-96x96.png>
</head>
Using your proposed approach, it would still grab the first link
and then would return null
because it doesn't have an href
attribute. But there's still a valid icon in there that has a href
set.
So I've updated the code so we'll only attempt to read the link
tag from the HTML if it has a href
attribute set.
Huge thanks for this though because you gave me a much-needed nudge to get this merged and fixed! 😄
Returns null instead of attempting to read something that isn't there. Works fine with the provided URL given in the issue #74.