From 824144214f82b4f00a82ac688a9adea7386c1bd0 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 17 Jan 2011 08:36:51 -0500
Subject: [PATCH] - Workaround for setting charset in case of malformed bodystructure response (#1487700)
---
CHANGELOG | 1 +
program/include/rcube_imap.php | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 28f6914..ec38b8e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,7 @@
- Fix login redirect issues (#1487686)
- Require PHP 5.2.1 or greater
- Fix %h/%z variables in username_domain option (#1487701)
+- Workaround for setting charset in case of malformed bodystructure response (#1487700)
RELEASE 0.5
-----------
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index efbd95f..fa79983 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -2053,7 +2053,7 @@
return false;
}
- $struct = &$this->_structure_part($structure);
+ $struct = &$this->_structure_part($structure, 0, '', $headers);
$struct->headers = get_object_vars($headers);
// don't trust given content-type
@@ -2185,6 +2185,11 @@
$struct->charset = $struct->ctype_parameters['charset'];
}
+ // #1487700: workaround for lack of charset in malformed structure
+ if (empty($struct->charset) && !empty($mime_headers) && $mime_headers->charset) {
+ $struct->charset = $mime_headers->charset;
+ }
+
// read content encoding
if (!empty($part[5]) && $part[5]!='NIL') {
$struct->encoding = strtolower($part[5]);
--
Gitblit v1.9.1