php-imap icon indicating copy to clipboard operation
php-imap copied to clipboard

parseBody() duplicates attachments

Open melnikaite opened this issue 1 year ago • 0 comments

Describe the bug

Raw email contains in my case only one attachment, and Message object also, but after calling parseBody() additional attachments is added, the same as first one

Code to Reproduce The troubling code section which produces the reported bug.

$messages = $folder->messages()->all()->fetchOrderAsc()->leaveUnread()->setFetchBody(true)->setFetchOrder($fetchOrder);
$messagePage = $messages->paginate(per_page: $perPage, page: ++$page);
foreach ($messagePage as $message) {
  $message->parseBody(); // duplicates attachments
}

Expected behaviour

Only unique attachments are listed in Message

Desktop / Server:

  • PHP: 8.2
  • Version: 5.5.0

melnikaite avatar Apr 23 '24 09:04 melnikaite