Skip to content

Commit

Permalink
Merge pull request #19 from JKingweb/favicon-loop
Browse files Browse the repository at this point in the history
Fix favicon finding endless loop
  • Loading branch information
nicolus committed Feb 13, 2020
2 parents 0bcba7e + d7fb537 commit efd6ce3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/PicoFeed/Reader/Favicon.php
Expand Up @@ -3,7 +3,7 @@
namespace PicoFeed\Reader;

use DOMXPath;
use GuzzleHttp\Exception\BadResponseException;
use GuzzleHttp\Exception\RequestException;
use PicoFeed\Base;
use PicoFeed\Client\Client;
use PicoFeed\Client\ClientException;
Expand Down Expand Up @@ -156,15 +156,17 @@ public function find($website_link, $favicon_link = '')

if ($this->content !== '') {
return $icon_link;
} elseif ($favicon_link !== '') {
return $this->find($website_link);
}
} catch (\Exception $e) {
return $this->find($website_link);
} catch (RequestException $e) {
continue;
}
}

return '';
if ($favicon_link !== '') {
return $this->find($website_link);
} else {
return '';
}
}

/**
Expand Down

0 comments on commit efd6ce3

Please sign in to comment.