From: Philipp Date: Tue, 3 Jan 2023 20:06:16 +0000 (+0100) Subject: Fix empty fetchResult curResult at Link::fetchMimeType (thx to Marco R.) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=176af67e88e128e5ad1b975e3e5b07f4d247b720;p=friendica.git Fix empty fetchResult curResult at Link::fetchMimeType (thx to Marco R.) --- diff --git a/src/Core/Storage/Type/ExternalResource.php b/src/Core/Storage/Type/ExternalResource.php index c988ea90c4..055db0deaa 100644 --- a/src/Core/Storage/Type/ExternalResource.php +++ b/src/Core/Storage/Type/ExternalResource.php @@ -63,7 +63,11 @@ class ExternalResource implements ICanReadFromStorage Logger::debug('Got picture', ['Content-Type' => $fetchResult->getHeader('Content-Type'), 'uid' => $data->uid, 'url' => $data->url]); return $fetchResult->getBody(); } else { - throw new ReferenceStorageException(sprintf('External resource failed to get %s', $reference), $fetchResult->getReturnCode(), new Exception($fetchResult->getBody())); + if (empty($fetchResult)) { + throw new ReferenceStorageException(sprintf('External resource failed to get %s', $reference)); + } else { + throw new ReferenceStorageException(sprintf('External resource failed to get %s', $reference), $fetchResult->getReturnCode(), new Exception($fetchResult->getBody())); + } } }