diff --git a/CHANGELOG b/CHANGELOG index 374418677..5ec7d5ec0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -26,6 +26,7 @@ CHANGELOG Roundcube Webmail - Fix so button label in Select image/media dialogs is "Close" not "Cancel" (#7246) - Fix regression in testing database schema on MSSQL (#7227) - Fix cursor position after inserting a group to a recipient input using autocompletion (#7267) +- Fix string literals handling in IMAP STATUS (and various other) responses (#7290) RELEASE 1.4.3 ------------- diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php index e5a30a520..fb0c3ac2e 100644 --- a/program/lib/Roundcube/rcube_imap_generic.php +++ b/program/lib/Roundcube/rcube_imap_generic.php @@ -3725,7 +3725,21 @@ class rcube_imap_generic $line = $this->readLine(4096); if ($response !== null) { - // TODO: Better string literals handling with filter + // In filter mode we need additional code for string literals. + // We'll merge the following literal data into one chunk, so + // it can be compared with the filter below + if ($filter && preg_match('/\{([0-9]+)\}\r\n$/', $line, $match)) { + // read and append the given bytes + $bytes = $match[1]; + $out = ''; + while (strlen($out) < $bytes) { + $tmp = $this->readBytes($bytes); + if ($tmp === null) break; + $out .= $tmp; + } + $line .= $out; + } + if (!$filter || preg_match($filter, $line)) { $response .= $line; }