mirror of
https://github.com/friendica/friendica
synced 2025-04-25 21:50:12 +00:00
Catch all errors thrown by "fetchRaw"
This commit is contained in:
parent
6870ccc00e
commit
2b513a48c7
8 changed files with 64 additions and 28 deletions
|
@ -125,8 +125,13 @@ class Link
|
|||
{
|
||||
$timeout = DI::config()->get('system', 'xrd_timeout');
|
||||
|
||||
$curlResult = HTTPSignature::fetchRaw($url, 0, [HttpClientOptions::TIMEOUT => $timeout, HttpClientOptions::ACCEPT_CONTENT => $accept]);
|
||||
if (empty($curlResult) || !$curlResult->isSuccess()) {
|
||||
try {
|
||||
$curlResult = HTTPSignature::fetchRaw($url, 0, [HttpClientOptions::TIMEOUT => $timeout, HttpClientOptions::ACCEPT_CONTENT => $accept]);
|
||||
if (empty($curlResult) || !$curlResult->isSuccess()) {
|
||||
return [];
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
Logger::notice('Error fetching url', ['url' => $url, 'error' => $th]);
|
||||
return [];
|
||||
}
|
||||
$fields = ['mimetype' => $curlResult->getHeader('Content-Type')[0]];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue