From 9f3b63b5f986fe583a89226f8412e9e91f5f4ca2 Mon Sep 17 00:00:00 2001 From: Benjamin Brahmer Date: Sun, 14 Nov 2021 11:28:33 +0100 Subject: Catch network errors while fetching feed logos, fixes #1570 Signed-off-by: Benjamin Brahmer --- AUTHORS.md | 3 +++ CHANGELOG.md | 1 + lib/Fetcher/FeedFetcher.php | 17 +++++++++-------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index fba40eaf0..a13867fd3 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -82,6 +82,7 @@ * [Alwaysin](mailto:adrien@demma.fr) * [Andrea Boero](mailto:mail@tsumi.it) * [Andreas Demmelbauer](mailto:git@notice.at) +* [Artem Lavrukhin](mailto:lavryha4590@gmail.com) * [Arthur Schiwon](mailto:blizzz@arthur-schiwon.de) * [Aurelien DAVID](mailto:aurelien.david@etu.unistra.fr) * [Aurelien DAVID](mailto:dav.aurelien@gmail.com) @@ -113,6 +114,8 @@ * [Frank Karlitschek](mailto:frank@owncloud.org) * [Freddo](mailto:f.falk@protonmail.com) * [Freddo3000](mailto:f.falk@protonmail.com) +* [Greg](mailto:greg@toolstack.com) +* [Hagen](mailto:derhagen@users.noreply.github.com) * [Hanzei](mailto:Hanzei@users.noreply.github.com) * [Hendrik Leppelsack](mailto:hendrik@leppelsack.de) * [Jasper Knockaert](mailto:jasper@knockaert.nl) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b0c67947..25f7e7957 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is almost based on [Keep a Changelog](https://keepachangelog.com/en/1 ### Changed ### Fixed +- Catch network errors while fetching feed logos. (#1570) # Releases ## [16.2.0] - 2021-11-03 diff --git a/lib/Fetcher/FeedFetcher.php b/lib/Fetcher/FeedFetcher.php index 7423c66df..5b48070d5 100755 --- a/lib/Fetcher/FeedFetcher.php +++ b/lib/Fetcher/FeedFetcher.php @@ -20,6 +20,7 @@ use FeedIo\FeedInterface; use FeedIo\FeedIo; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\ConnectException; use Net_URL2; use OCP\IL10N; @@ -376,14 +377,14 @@ class FeedFetcher implements IFeedFetcher 'logo' => $favicon ] ); - } catch (RequestException $e) { - $this->logger->info( - 'An error occurred while trying to download the feed logo of {url}: {error}', - [ - 'url' => $url, - 'error' => $e->getResponse() ?? 'Unknown' - ] - ); + } catch (RequestException | ConnectException $e) { + $this->logger->info( + 'An error occurred while trying to download the feed logo of {url}: {error}', + [ + 'url' => $url, + 'error' => $e->getResponse() ?? 'Unknown' + ] + ); } $is_image = $downloaded && substr(mime_content_type($favicon_path), 0, 5) === "image"; -- cgit v1.2.3