]> git.mxchange.org Git - friendica-addons.git/commitdiff
catch exception during http request
authorMatthew Exon <git.mexon@spamgourmet.com>
Sun, 28 May 2023 09:02:32 +0000 (11:02 +0200)
committerMatthew Exon <git.mexon@spamgourmet.com>
Sun, 28 May 2023 09:02:32 +0000 (11:02 +0200)
mailstream/mailstream.php

index f53d4fe9755824d2df42a59ec5edd1f80ece5d6a..56e7fa132db0e196c81c61b847b7886f1b8518b1 100644 (file)
@@ -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),