summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2008-02-12 14:06:26 +0000
committerthomascube <thomas@roundcube.net>2008-02-12 14:06:26 +0000
commitddc34f98d5d0a4669fd0d74cf5e9c549adc87e41 (patch)
tree11c8b007fe7acbabd482feebf78613483fffe530 /program/include
parent90180eff2f9e7dcf4112c815a94dce774deeda21 (diff)
Also do charset decoding as suggested in RFC 2231 (fix #1484321)
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_imap.inc12
1 files changed, 8 insertions, 4 deletions
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index f7584041a..dce778968 100644
--- a/program/include/rcube_imap.inc
+++ b/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']);