ash-jc-allen / favicon-fetcher

A Laravel package for fetching favicons from websites.
MIT License
173 stars 13 forks source link

Exception thrown when link icon tag doesn't have href attribute #74

Closed tushargugnani closed 6 months ago

tushargugnani commented 8 months ago

AshAllenDesign\FaviconFetcher\Drivers\HttpDriver::convertToAbsoluteUrl(): Argument #2 ($faviconUrl) must be of type string, null given, called in /Users/tgugnani/Code/thehome/vendor/ashallendesign/favicon-fetcher/src/Drivers/HttpDriver.php on line 189

When trying to fetch favicon from a URL which does not have a href tag in it, exception is thrown. Can we modify the code so that fails gracefully.

ash-jc-allen commented 8 months ago

Hey @tushargugnani! Do you have an example of a website that is giving you this error? 🙂

tushargugnani commented 8 months ago

@ash-jc-allen Yes, https://meodai.github.io/poline/

ash-jc-allen commented 8 months ago

Ahhh yeah! In that case, yeah I'd be open to any PRs that ignore any <link> tags that don't have the href set 🙂

ash-jc-allen commented 6 months ago

Hey @tushargugnani! Thanks to a bug fix by @philipsorensen, this should now be fixed in v3.4.1 😄

Release notes: https://github.com/ash-jc-allen/favicon-fetcher/releases/tag/v3.4.1