forked from friendica/friendica-addons
Merge pull request 'catch exception during http request' (#1392) from mexon/friendica-addons:mat/mailstream-exception into develop
Reviewed-on: friendica/friendica-addons#1392
This commit is contained in:
commit
54f4a054c7
1 changed files with 6 additions and 1 deletions
|
@ -214,7 +214,12 @@ function mailstream_do_images(array &$item, array &$attachments)
|
||||||
}
|
}
|
||||||
|
|
||||||
$cookiejar = tempnam(System::getTempPath(), 'cookiejar-mailstream-');
|
$cookiejar = tempnam(System::getTempPath(), 'cookiejar-mailstream-');
|
||||||
$curlResult = DI::httpClient()->fetchFull($url, HttpClientAccept::DEFAULT, 0, $cookiejar);
|
try {
|
||||||
|
$curlResult = DI::httpClient()->fetchFull($url, HttpClientAccept::DEFAULT, 0, $cookiejar);
|
||||||
|
} catch (InvalidArgumentException $e) {
|
||||||
|
Logger::error('mailstream_do_images exception fetching url', ['url' => $url, 'item_id' => $item['id']]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$attachments[$url] = [
|
$attachments[$url] = [
|
||||||
'data' => $curlResult->getBody(),
|
'data' => $curlResult->getBody(),
|
||||||
'guid' => hash('crc32', $url),
|
'guid' => hash('crc32', $url),
|
||||||
|
|
Loading…
Reference in a new issue