Fix empty fetchResult curResult at Link::fetchMimeType (thx to Marco R.)

This commit is contained in:
Philipp Holzer 2023-01-03 21:06:16 +01:00
parent 3110831131
commit 176af67e88
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432

View file

@ -62,10 +62,14 @@ class ExternalResource implements ICanReadFromStorage
if (!empty($fetchResult) && $fetchResult->isSuccess()) {
Logger::debug('Got picture', ['Content-Type' => $fetchResult->getHeader('Content-Type'), 'uid' => $data->uid, 'url' => $data->url]);
return $fetchResult->getBody();
} else {
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()));
}
}
}
/**
* @inheritDoc