Fix broken long filenames when using imap4d server - workaround server bug (#6048)

pull/6072/head
Aleksander Machniak 7 years ago
parent 4b29748161
commit 0c56b5d4c0

@ -1,6 +1,8 @@
CHANGELOG Roundcube Webmail
===========================
- Fix broken long filenames when using imap4d server - workaround server bug (#6048)
RELEASE 1.3.3
-------------
- Fix decoding of mailto: links with + character in HTML messages (#6020)

@ -212,9 +212,21 @@ class rcube_mime
// Decode and join encoded-word's chunks
if ($encoding == 'B' || $encoding == 'b') {
// base64 must be decoded a segment at a time
for ($i=0; $i<$count; $i++)
$text .= base64_decode($tmp[$i]);
$rest = '';
// base64 must be decoded a segment at a time.
// However, there are broken implementations that continue
// in the following word, we'll handle that (#6048)
for ($i=0; $i<$count; $i++) {
$chunk = $rest . $tmp[$i];
$length = strlen($chunk);
if ($length % 4) {
$length = floor($length / 4) * 4;
$rest = substr($chunk, $length);
$chunk = substr($chunk, 0, $length);
}
$text .= base64_decode($chunk);
}
}
else { //if ($encoding == 'Q' || $encoding == 'q') {
// quoted printable can be combined and processed at once

Loading…
Cancel
Save