summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-10-20 11:41:48 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-10-20 11:41:48 +0000
commit8345d029b747611ac09c488fad0056f840894f4d (patch)
tree6d17e1a56c10c37af8c313b54afd2549e4f042b7
parent335b484c7a865d45f39533ae0ac838cc94a5f4e9 (diff)
- Add workaround for some Outlook's wrong content-types, per discussion in #1487051
git-svn-id: https://svn.roundcube.net/trunk@4115 208e9e7b-5314-0410-a742-e7e81cd9613c
-rw-r--r--roundcubemail/program/steps/mail/func.inc10
-rw-r--r--roundcubemail/program/steps/mail/get.inc1
-rw-r--r--roundcubemail/program/steps/mail/show.inc2
3 files changed, 12 insertions, 1 deletions
diff --git a/roundcubemail/program/steps/mail/func.inc b/roundcubemail/program/steps/mail/func.inc
index 668d8c7e5..629e68bfd 100644
--- a/roundcubemail/program/steps/mail/func.inc
+++ b/roundcubemail/program/steps/mail/func.inc
@@ -1717,6 +1717,16 @@ function rcmail_user_date()
return $date;
}
+// Fixes some content-type names
+function rcmail_fix_mimetype($name)
+{
+ // Some versions of Outlook create garbage Content-Type:
+ // application/pdf.A520491B_3BF7_494D_8855_7FAC2C6C0608
+ if (preg_match('/^application\/pdf.+/', $name))
+ $name = 'application/pdf';
+
+ return $name;
+}
function rcmail_search_filter($attrib)
{
diff --git a/roundcubemail/program/steps/mail/get.inc b/roundcubemail/program/steps/mail/get.inc
index 3c4e4fbfc..5b9e97776 100644
--- a/roundcubemail/program/steps/mail/get.inc
+++ b/roundcubemail/program/steps/mail/get.inc
@@ -91,6 +91,7 @@ else if ($pid = get_input_value('_part', RCUBE_INPUT_GET)) {
header("Content-Type: text/$ctype_secondary; charset=" . ($part->charset ? $part->charset : RCMAIL_CHARSET));
}
else {
+ $mimetype = rcmail_fix_mimetype($mimetype);
header("Content-Type: $mimetype");
header("Content-Transfer-Encoding: binary");
}
diff --git a/roundcubemail/program/steps/mail/show.inc b/roundcubemail/program/steps/mail/show.inc
index 328e9d0c7..c3046f634 100644
--- a/roundcubemail/program/steps/mail/show.inc
+++ b/roundcubemail/program/steps/mail/show.inc
@@ -172,7 +172,7 @@ function rcmail_message_attachments($attrib)
'return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)',
JS_OBJECT_NAME,
$attach_prop->mime_id,
- $attach_prop->mimetype),
+ rcmail_fix_mimetype($attach_prop->mimetype)),
'title' => Q($title),
),
Q($filename)));