catch exception during http request #1392

Merged
MrPetovan merged 1 commit from mexon/friendica-addons:mat/mailstream-exception into develop 2023-05-28 16:46:43 +02:00
Showing only changes of commit 9832fa6c45 - Show all commits

View file

@ -214,7 +214,12 @@ function mailstream_do_images(array &$item, array &$attachments)
}
$cookiejar = tempnam(System::getTempPath(), 'cookiejar-mailstream-');
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] = [
'data' => $curlResult->getBody(),
'guid' => hash('crc32', $url),