alecpl
2010-10-20 e0bd7054b7e566bf156e8afdc6d4c790fed0c0f2
- Add workaround for some Outlook's wrong content-types, per discussion in #1487051


3 files modified
13 ■■■■■ changed files
program/steps/mail/func.inc 10 ●●●●● patch | view | raw | blame | history
program/steps/mail/get.inc 1 ●●●● patch | view | raw | blame | history
program/steps/mail/show.inc 2 ●●● patch | view | raw | blame | history
program/steps/mail/func.inc
@@ -1717,6 +1717,16 @@
  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)
{
program/steps/mail/get.inc
@@ -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");
    }
program/steps/mail/show.inc
@@ -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)));