Skip to content

Commit

Permalink
remove path of url before searching for favicon
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
  • Loading branch information
Grotax committed Apr 28, 2021
1 parent 9705e6a commit 5c7adb1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Fetcher/FeedFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,18 @@ protected function getFavicon(FeedInterface $feed, string $url)

$is_image = substr(mime_content_type($favicon_path), 0, 5) === "image";

$base_url = new Net_URL2($url);
$base_url->setPath('');

// check if file is actually an image
if (!$is_image) {
return $this->faviconFactory->get($url);
return $this->faviconFactory->get($base_url->getNormalizedURL());
}

list($width, $height, $type, $attr) = getimagesize($favicon_path);
// check if image is square else fall back to favicon
if ($width !== $height) {
return $this->faviconFactory->get($url);
return $this->faviconFactory->get($base_url);
}

return $favicon;
Expand Down

0 comments on commit 5c7adb1

Please sign in to comment.