#1485730 closed Bugs (duplicate)
misdetected office attachments (detected as text/plain instead of application/vnd-...)
| Reported by: | niemand | Owned by: | |
|---|---|---|---|
| Priority: | 3 | Milestone: | later |
| Component: | MIME parsing | Version: | git-master |
| Severity: | normal | Keywords: | office attachments misdetected by mime detection code text plain plaintext doc xls patch |
| Cc: | re@… |
Description
Even in 0.2-stable, attached MS-Office-Documents (doc, xls, etc.) are still detected as text/plain falsely, so that these attachments are displayed in plaintext bytewise.
The mime-detect.patch (http://trac.roundcube.net/attachment/ticket/1485311/mime-detect.patch) does not work on 0.2-stable anymore, since there is no program/steps/mail/upload.inc anymore and mime detection is made in program/lib/Mail/mime.php now.
A workaround for 0.2-stable is to place the following lines in program/lib/Mail/mime.php at the beginning of function addAttachment(), but i think this fundamental problem should be fixed in general.
if ($c_type='text/plain') {
$mime_ext = array(
'pdf' => 'application/pdf',
'xls' => 'application/vnd.ms-excel',
'xlm' => 'application/vnd.ms-excel',
'xla' => 'application/vnd.ms-excel',
'xlc' => 'application/vnd.ms-excel',
'xlt' => 'application/vnd.ms-excel',
'xlw' => 'application/vnd.ms-excel',
'ppt' => 'application/vnd.ms-powerpoint',
'pps' => 'application/vnd.ms-powerpoint',
'pot' => 'application/vnd.ms-powerpoint',
'doc' => 'application/msword',
'dot' => 'application/msword',
'odc' => 'application/vnd.oasis.opendocument.chart',
'otc' => 'application/vnd.oasis.opendocument.chart-template',
'odf' => 'application/vnd.oasis.opendocument.formula',
'otf' => 'application/vnd.oasis.opendocument.formula-template',
'odg' => 'application/vnd.oasis.opendocument.graphics',
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
'odi' => 'application/vnd.oasis.opendocument.image',
'oti' => 'application/vnd.oasis.opendocument.image-template',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
'odt' => 'application/vnd.oasis.opendocument.text',
'otm' => 'application/vnd.oasis.opendocument.text-master',
'ott' => 'application/vnd.oasis.opendocument.text-template',
'oth' => 'application/vnd.oasis.opendocument.text-web',
'docm' => 'application/vnd.ms-word.document.macroEnabled.12',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'dotm' => 'application/vnd.ms-word.template.macroEnabled.12',
'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'xps' => 'application/vnd.ms-xpsdocument',
'rar' => 'application/x-rar-compressed'
);
if ($name) {
$nameprts = split("\.", $name);
$ext = end($nameprts);
if ($ext && isset($mime_ext[$ext]))
$c_type=$mime_ext[$ext];
}
}
Change History (2)
comment:1 Changed 4 years ago by com2
- Cc re@… added
- Priority changed from 4 to 3
- Version changed from 0.2-stable to svn-trunk
comment:2 Changed 4 years ago by thomasb
- Resolution set to duplicate
- Status changed from new to closed
Duplicate of #1485311

I tried svn [9b4aaa79] and it has the same bug. Is especially annoying for Outlook recipients (tested with 2003 and 2007) because it takes the mime type really strict and saves it as plain/text.