]> git.mxchange.org Git - friendica.git/commitdiff
Fix empty fetchResult curResult at Link::fetchMimeType (thx to Marco R.)
authorPhilipp <admin@philipp.info>
Tue, 3 Jan 2023 20:06:16 +0000 (21:06 +0100)
committerPhilipp <admin@philipp.info>
Tue, 3 Jan 2023 20:06:16 +0000 (21:06 +0100)
src/Core/Storage/Type/ExternalResource.php

index c988ea90c487da7be0faadaa61b17829f7a0ac2f..055db0deaa9f4e02edb2dff81a3cf0d6f3064f09 100644 (file)
@@ -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()));
+                       }
                }
        }