diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-06-07 18:48:59 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-06-07 18:48:59 +0000 |
| commit | eb64fd9b275f5367ca5bbce8626467a3e338a99e (patch) | |
| tree | 31a8e981c8d61a0b27806dd84bf657f6cc8e9822 /roundcubemail/program/include/rcube_imap.php | |
| parent | f91adb2e30eae548dd457327a6ca50217dfc909e (diff) | |
-added encoding detection for attachment names when message part hasn't got charset definition (#1484969)
git-svn-id: https://svn.roundcube.net/trunk@1490 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_imap.php')
| -rw-r--r-- | roundcubemail/program/include/rcube_imap.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php index 574ed6cc2..9d8f6d314 100644 --- a/roundcubemail/program/include/rcube_imap.php +++ b/roundcubemail/program/include/rcube_imap.php @@ -1159,10 +1159,13 @@ class rcube_imap if (is_array($part[8]) && empty($struct->parts)) $struct->parts[] = $this->_structure_part($part[8], ++$count, $struct->mime_id); } - + // normalize filename property if ($filename_mime = $struct->d_parameters['filename'] ? $struct->d_parameters['filename'] : $struct->ctype_parameters['name']) - $struct->filename = rcube_imap::decode_mime_string($filename_mime, $this->default_charset); + { + $struct->filename = rcube_imap::decode_mime_string($filename_mime, + $struct->charset ? $struct->charset : rc_detect_encoding($filename_mime, $this->default_charset)); + } else if ($filename_encoded = $struct->d_parameters['filename*'] ? $struct->d_parameters['filename*'] : $struct->ctype_parameters['name*']) { // decode filename according to RFC 2231, Section 4 @@ -1170,7 +1173,8 @@ class rcube_imap $struct->filename = rcube_charset_convert(urldecode($filename_urlencoded), $filename_charset); } else if (!empty($struct->headers['content-description'])) - $struct->filename = rcube_imap::decode_mime_string($struct->headers['content-description'], $this->default_charset); + $struct->filename = rcube_imap::decode_mime_string($struct->headers['content-description'], + $struct->charset ? $struct->charset : rc_detect_encoding($struct->headers['content-description'],$this->default_charset)); return $struct; } |
