Skip to content

Commit

Permalink
Merge pull request #8930 from nextcloud/fix/return-when-headers-cant-…
Browse files Browse the repository at this point in the history
…be-parsed

fix(sync): return if headers couldn't be parsed
  • Loading branch information
miaulalala authored Oct 9, 2023
2 parents 1ec5caa + 998bf34 commit 2a41b47
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/IMAP/ImapMessageFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
use Horde_Imap_Client_Fetch_Query;
use Horde_Imap_Client_Ids;
use Horde_ListHeaders;
use Horde_ListHeaders_Base;
use Horde_Mime_Exception;
use Horde_Mime_Headers;
use Horde_Mime_Part;
Expand Down Expand Up @@ -523,8 +522,11 @@ private function parseHeaders(Horde_Imap_Client_Data_Fetch $fetch): void {
$listUnsubscribeHeader = $parsedHeaders->getHeader('list-unsubscribe');
if ($listUnsubscribeHeader !== null) {
$listHeaders = new Horde_ListHeaders();
/** @var Horde_ListHeaders_Base[] $headers */
$headers = $listHeaders->parse($listUnsubscribeHeader->name, $listUnsubscribeHeader->value_single);
if (!$headers) {
// Unable to parse headers
return;
}
foreach ($headers as $header) {
if (str_starts_with($header->url, 'http')) {
$this->unsubscribeUrl = $header->url;
Expand Down

0 comments on commit 2a41b47

Please sign in to comment.