Merge pull request #12604 from nupplaphil/bug/marco_r
Some Bugfixings (thx to Marco R.)
This commit is contained in:
commit
0ab5fed64c
|
@ -63,7 +63,11 @@ class ExternalResource implements ICanReadFromStorage
|
||||||
Logger::debug('Got picture', ['Content-Type' => $fetchResult->getHeader('Content-Type'), 'uid' => $data->uid, 'url' => $data->url]);
|
Logger::debug('Got picture', ['Content-Type' => $fetchResult->getHeader('Content-Type'), 'uid' => $data->uid, 'url' => $data->url]);
|
||||||
return $fetchResult->getBody();
|
return $fetchResult->getBody();
|
||||||
} else {
|
} 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()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ class Link
|
||||||
$timeout = DI::config()->get('system', 'xrd_timeout');
|
$timeout = DI::config()->get('system', 'xrd_timeout');
|
||||||
|
|
||||||
$curlResult = HTTPSignature::fetchRaw($url, 0, [HttpClientOptions::TIMEOUT => $timeout, HttpClientOptions::ACCEPT_CONTENT => $accept]);
|
$curlResult = HTTPSignature::fetchRaw($url, 0, [HttpClientOptions::TIMEOUT => $timeout, HttpClientOptions::ACCEPT_CONTENT => $accept]);
|
||||||
if (!$curlResult->isSuccess()) {
|
if (empty($curlResult) || !$curlResult->isSuccess()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$fields = ['mimetype' => $curlResult->getHeader('Content-Type')[0]];
|
$fields = ['mimetype' => $curlResult->getHeader('Content-Type')[0]];
|
||||||
|
|
Loading…
Reference in a new issue