summaryrefslogtreecommitdiff
path: root/program/include/rcube_imap.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-10-21 17:29:21 +0000
committeralecpl <alec@alec.pl>2011-10-21 17:29:21 +0000
commit7e50b4361c7094bb33fced2ef96b95acd4d87640 (patch)
tree7a4c002b79b1c5ff9364d01101422278cf8eef7f /program/include/rcube_imap.php
parent544619a4550da562e849ac9d05152d8055d009b9 (diff)
- Small code improvement
Diffstat (limited to 'program/include/rcube_imap.php')
-rw-r--r--program/include/rcube_imap.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index c07b39883..b04a28615 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -2320,9 +2320,14 @@ class rcube_imap
// decode filename
if (!empty($filename_mime)) {
- $part->filename = rcube_imap::decode_mime_string($filename_mime,
- $part->charset ? $part->charset : ($this->struct_charset ? $this->struct_charset :
- rc_detect_encoding($filename_mime, $this->default_charset)));
+ if (!empty($part->charset))
+ $charset = $part->charset;
+ else if (!empty($this->struct_charset))
+ $charset = $this->struct_charset;
+ else
+ $charset = rc_detect_encoding($filename_mime, $this->default_charset);
+
+ $part->filename = rcube_imap::decode_mime_string($filename_mime, $charset);
}
else if (!empty($filename_encoded)) {
// decode filename according to RFC 2231, Section 4
@@ -2330,6 +2335,7 @@ class rcube_imap
$filename_charset = $fmatches[1];
$filename_encoded = $fmatches[2];
}
+
$part->filename = rcube_charset_convert(urldecode($filename_encoded), $filename_charset);
}
}