[Svn] r4115 - trunk/roundcubemail/program/steps/mail

trac at roundcube.net trac at roundcube.net
Wed Oct 20 13:41:48 CEST 2010


Author: alec
Date: 2010-10-20 06:41:48 -0500 (Wed, 20 Oct 2010)
New Revision: 4115

Modified:
   trunk/roundcubemail/program/steps/mail/func.inc
   trunk/roundcubemail/program/steps/mail/get.inc
   trunk/roundcubemail/program/steps/mail/show.inc
Log:
- Add workaround for some Outlook's wrong content-types, per discussion in #1487051


Modified: trunk/roundcubemail/program/steps/mail/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/func.inc	2010-10-20 11:27:39 UTC (rev 4114)
+++ trunk/roundcubemail/program/steps/mail/func.inc	2010-10-20 11:41:48 UTC (rev 4115)
@@ -1717,7 +1717,17 @@
   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)
 {
   global $OUTPUT, $CONFIG;

Modified: trunk/roundcubemail/program/steps/mail/get.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/get.inc	2010-10-20 11:27:39 UTC (rev 4114)
+++ trunk/roundcubemail/program/steps/mail/get.inc	2010-10-20 11:41:48 UTC (rev 4115)
@@ -91,6 +91,7 @@
       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");
     }

Modified: trunk/roundcubemail/program/steps/mail/show.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/show.inc	2010-10-20 11:27:39 UTC (rev 4114)
+++ trunk/roundcubemail/program/steps/mail/show.inc	2010-10-20 11:41:48 UTC (rev 4115)
@@ -172,7 +172,7 @@
               '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)));

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list