From b6d1154260b775ccfccac2302e340ae1b445c93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 13 Mar 2023 18:18:04 +0100 Subject: [PATCH] fix(references): Do not log errors on 404 responses of opengraph image fetching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Collaboration/Reference/LinkReferenceProvider.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/private/Collaboration/Reference/LinkReferenceProvider.php b/lib/private/Collaboration/Reference/LinkReferenceProvider.php index 2a6d4d5afaf..448a55f9300 100644 --- a/lib/private/Collaboration/Reference/LinkReferenceProvider.php +++ b/lib/private/Collaboration/Reference/LinkReferenceProvider.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace OC\Collaboration\Reference; use Fusonic\OpenGraph\Consumer; +use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Psr7\LimitStream; use GuzzleHttp\Psr7\Utils; use OC\Security\RateLimiting\Exception\RateLimitExceededException; @@ -167,6 +168,8 @@ class LinkReferenceProvider implements IReferenceProvider { $folder->newFile(md5($reference->getId()), $bodyStream->getContents()); $reference->setImageUrl($this->urlGenerator->linkToRouteAbsolute('core.Reference.preview', ['referenceId' => md5($reference->getId())])); } + } catch (GuzzleException $e) { + $this->logger->info('Failed to fetch and store the open graph image for ' . $reference->getId(), ['exception' => $e]); } catch (\Throwable $e) { $this->logger->error('Failed to fetch and store the open graph image for ' . $reference->getId(), ['exception' => $e]); }