Merge pull request #12604 from nupplaphil/bug/marco_r
Some Bugfixings (thx to Marco R.)
This commit is contained in:
commit
0ab5fed64c
|
@ -62,10 +62,14 @@ class ExternalResource implements ICanReadFromStorage
|
||||||
if (!empty($fetchResult) && $fetchResult->isSuccess()) {
|
if (!empty($fetchResult) && $fetchResult->isSuccess()) {
|
||||||
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 {
|
||||||
|
if (empty($fetchResult)) {
|
||||||
|
throw new ReferenceStorageException(sprintf('External resource failed to get %s', $reference));
|
||||||
} else {
|
} else {
|
||||||
throw new ReferenceStorageException(sprintf('External resource failed to get %s', $reference), $fetchResult->getReturnCode(), new Exception($fetchResult->getBody()));
|
throw new ReferenceStorageException(sprintf('External resource failed to get %s', $reference), $fetchResult->getReturnCode(), new Exception($fetchResult->getBody()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
|
|
|
@ -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