Skip to content

Commit

Permalink
Merge pull request 'catch exception during http request' (#1392) from…
Browse files Browse the repository at this point in the history
… mexon/friendica-addons:mat/mailstream-exception into develop

Reviewed-on: https://git.friendi.ca/friendica/friendica-addons/pulls/1392
  • Loading branch information
MrPetovan committed May 28, 2023
2 parents 2ce14fb + 9832fa6 commit 54f4a05
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mailstream/mailstream.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,12 @@ function mailstream_do_images(array &$item, array &$attachments)
}

$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] = [
'data' => $curlResult->getBody(),
'guid' => hash('crc32', $url),
Expand Down

0 comments on commit 54f4a05

Please sign in to comment.