Merge pull request #12604 from nupplaphil/bug/marco_r

Some Bugfixings (thx to Marco R.)
This commit is contained in:
Hypolite Petovan 2023-01-03 15:14:15 -05:00 committed by GitHub
commit 0ab5fed64c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View 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()));
}
}
}

View file

@ -126,7 +126,7 @@ class Link
$timeout = DI::config()->get('system', 'xrd_timeout');
$curlResult = HTTPSignature::fetchRaw($url, 0, [HttpClientOptions::TIMEOUT => $timeout, HttpClientOptions::ACCEPT_CONTENT => $accept]);
if (!$curlResult->isSuccess()) {
if (empty($curlResult) || !$curlResult->isSuccess()) {
return [];
}
$fields = ['mimetype' => $curlResult->getHeader('Content-Type')[0]];