summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-02-12 14:06:26 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-02-12 14:06:26 +0000
commitc585f7a40034c218e97f98bdd1776ad939615795 (patch)
tree24523319cedf91f9f703ad664ecab9e2434b479d /roundcubemail/program/include
parentb6fd5b5e4b2a8637f880a3af87beec16c03f1be2 (diff)
Also do charset decoding as suggested in RFC 2231 (fix #1484321)
git-svn-id: https://svn.roundcube.net/trunk@1050 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
-rw-r--r--roundcubemail/program/include/rcube_imap.inc12
1 files changed, 8 insertions, 4 deletions
diff --git a/roundcubemail/program/include/rcube_imap.inc b/roundcubemail/program/include/rcube_imap.inc
index f7584041a..dce778968 100644
--- a/roundcubemail/program/include/rcube_imap.inc
+++ b/roundcubemail/program/include/rcube_imap.inc
@@ -1145,10 +1145,14 @@ class rcube_imap
}
// normalize filename property
- if (!empty($struct->d_parameters['filename']))
- $struct->filename = $this->decode_mime_string($struct->d_parameters['filename']);
- else if (!empty($struct->ctype_parameters['name']))
- $struct->filename = $this->decode_mime_string($struct->ctype_parameters['name']);
+ if ($filename_mime = $struct->d_parameters['filename'] ? $struct->d_parameters['filename'] : $struct->ctype_parameters['name'])
+ $struct->filename = $this->decode_mime_string($filename_mime);
+ else if ($filename_encoded = $struct->d_parameters['filename*'] ? $struct->d_parameters['filename*'] : $struct->ctype_parameters['name*'])
+ {
+ // decode filename according to RFC 2231, Section 4
+ list($filename_charset,, $filename_urlencoded) = split('\'', $filename_encoded);
+ $struct->filename = rcube_charset_convert(urldecode($filename_urlencoded), $filename_charset);
+ }
else if (!empty($struct->headers['content-description']))
$struct->filename = $this->decode_mime_string($struct->headers['content-description']);