From 94a99c11f440dc4cef2db9b087586f3fb0f6c9b1 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Tue, 23 Sep 2008 03:46:25 -0400 Subject: [PATCH] - fixed handling of apostrophes in filenames decoded according to rfc2231 --- program/include/rcube_imap.php | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index e7ad17a..0853ab4 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -1057,7 +1057,7 @@ if ($this->caching_enabled) $this->add_message_cache($cache_key, $msg_id, $headers, $struct); } - + return $struct; } @@ -1271,8 +1271,11 @@ } else if (!empty($filename_encoded)) { // decode filename according to RFC 2231, Section 4 - list($filename_charset,, $filename_urlencoded) = split('\'', $filename_encoded); - $part->filename = rcube_charset_convert(urldecode($filename_urlencoded), $filename_charset); + if (preg_match("/^([^']*)'[^']*'(.*)$/", $filename_encoded, $fmatches)) { + $filename_charset = $fmatches[1]; + $filename_encoded = $fmatches[2]; + } + $part->filename = rcube_charset_convert(urldecode($filename_encoded), $filename_charset); } } -- Gitblit v1.9.1