Skip to content

Commit

Permalink
Use Horde_Mime_Part to normalize/sanitize the MIME type
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Apr 25, 2015
1 parent 3075e18 commit e449aae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions framework/Mime_Viewer/lib/Horde/Mime/Viewer/Tnef.php
Expand Up @@ -89,14 +89,15 @@ protected function _getEmbeddedMimeParts()
$temp_part->setName($data['name']);
$temp_part->setDescription($data['name']);
$temp_part->setContents($data['stream']);
$temp_part->setType($data['type'] . '/' . $data['subtype']);

/* Short-circuit MIME-type guessing for winmail.dat parts;
* we're showing enough entries for them already. */
$type = $data['type'] . '/' . $data['subtype'];
if (in_array($type, array('application/octet-stream', 'application/base64'))) {
$type = Horde_Mime_Magic::filenameToMIME($data['name']);
if (in_array($temp_part->getType(), array('application/octet-stream', 'application/base64'))) {
$temp_part->setType(
Horde_Mime_Magic::filenameToMIME($data['name'])
);
}
$temp_part->setType($type);

$mixed->addPart($temp_part);
}
Expand Down

0 comments on commit e449aae

Please sign in to comment.