ash-jc-allen / favicon-fetcher

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

Strip the path from relative URLs #47

Closed ash-jc-allen closed 1 year ago

ash-jc-allen commented 1 year ago

This PR strips the path from the URLs if a favicon URL is relative.

Say example.com has their favicon available at example.com/favicon.ico by specifying it in their HTML like so:

<link rel="icon" href="favicon.ico" />

Now let's say we use Favicon::driver('http')->fetch('https://example.com/blog'). Previously, this would have returned https://example.com/blog/favicon.ico because we were just concatenating the website URL and the favicon's relative path.

This PR will strip the path from the URL, so it will return https://example.com/favicon.ico instead 🙂