From 0f9d8ca40de826733f0507b9706d18dd1e8719f4 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 18 Nov 2010 05:34:10 -0500
Subject: [PATCH] - Don't set attachment's charset in Content-type header (#1487122)

---
 CHANGELOG                        |    1 +
 program/include/rcube_shared.inc |    6 +++---
 program/steps/mail/sendmail.inc  |    2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 4004eaa..761030b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -73,6 +73,7 @@
 - Fix focused elements aren't unfocused when clicking on the list (#1487123)
 - Fix error in MSSQL DDL scripts (#1487112)
 - Lock submit button in onsubmit event on login page (#1487036)
+- Don't set attachment's charset in Content-type header (#1487122)
 
 RELEASE 0.4.2
 -------------
diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index b79ab36..d6d91e0 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -477,9 +477,9 @@
         $mime_type = $failover;
     }
     else {
-        // sometimes content-type contains charset definition,
-        // remove useless "charset=binary", should we remove any charset def. here?
-        $mime_type = preg_replace('/; charset=binary;*/i', '', $mime_type);
+        // Sometimes (PHP-5.3?) content-type contains charset definition,
+        // Remove it (#1487122) also "charset=binary" is useless
+        $mime_type = array_shift(preg_split('/[; ]/', $mime_type));
     }
 
     return $mime_type;
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index c8ceb8f..81e5a21 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -503,7 +503,7 @@
         ($attachment['data'] ? false : true),
         ($ctype == 'message/rfc822' ? '8bit' : 'base64'),
         ($ctype == 'message/rfc822' ? 'inline' : 'attachment'),
-        $message_charset, '', '', 
+        '', '', '',
         $CONFIG['mime_param_folding'] ? 'quoted-printable' : NULL,
         $CONFIG['mime_param_folding'] == 2 ? 'quoted-printable' : NULL
       );

--
Gitblit v1.9.1