diff options
Diffstat (limited to 'lib/IMAP')
-rw-r--r-- | lib/IMAP/MessageMapper.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/IMAP/MessageMapper.php b/lib/IMAP/MessageMapper.php index e5b0e46a6..47160e65a 100644 --- a/lib/IMAP/MessageMapper.php +++ b/lib/IMAP/MessageMapper.php @@ -39,6 +39,7 @@ use OCP\AppFramework\Db\DoesNotExistException; use Psr\Log\LoggerInterface; use function array_filter; use function array_map; +use function in_array; use function iterator_to_array; use function reset; @@ -455,8 +456,9 @@ class MessageMapper { } public function getRawAttachments(Horde_Imap_Client_Socket $client, - string $mailbox, - int $uid): array { + string $mailbox, + int $uid, + ?array $attachmentIds = []): array { $messageQuery = new Horde_Imap_Client_Fetch_Query(); $messageQuery->structure(); @@ -477,6 +479,10 @@ class MessageMapper { // Ignore message header continue; } + if (!empty($attachmentIds) && !in_array($part->getMIMEId(), $attachmentIds, true)) { + // We are looking for specific parts only and this is not one of them + continue; + } $partsQuery->bodyPart($part->getMimeId(), [ 'peek' => true, |