Skip to content

Commit

Permalink
Optimize fetchPartBody() for huge results w/o formatting and decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed May 8, 2023
1 parent a20445f commit 3648caa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions program/lib/Roundcube/rcube_imap_generic.php
Expand Up @@ -2961,6 +2961,10 @@ public function handlePartBody($mailbox, $id, $is_uid = false, $part = '', $enco
if (!$bytes) {
$result = '';
}
// An optimal path for a case when we need the body as-is in a string
else if (!$mode && !$file && !$print && !$formatted) {
$result = $this->readBytes($bytes);
}
else while ($bytes > 0) {
$line = $this->readBytes($bytes > $chunkSize ? $chunkSize : $bytes);

Expand Down

0 comments on commit 3648caa

Please sign in to comment.