From eaf0ec8bbaaeb1405863771dcc7d9e44f05072c8 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 13 Sep 2010 01:08:49 -0600 Subject: [PATCH] Bug #9245: Link attachments if guessed MIME type has a viewer --- imp/lib/Contents.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index 3cb570662..e3865df01 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -624,6 +624,10 @@ class IMP_Contents * if we can guess a rendering type. */ if (in_array($mime_type, array('application/octet-stream', 'application/base64'))) { $mime_type = Horde_Mime_Magic::filenameToMIME($mime_part->getName()); + if ($mime_type != $mime_part->getType()) { + $mime_part = clone $mime_part; + $mime_part->setType($mime_type); + } $param_array['ctype'] = $mime_type; } $part['type'] = $mime_type; @@ -651,7 +655,7 @@ class IMP_Contents } if ($mask & self::SUMMARY_DESCRIP_LINK) { - $part['description'] = $this->canDisplay($id, self::RENDER_FULL) + $part['description'] = $this->canDisplay($mime_part, self::RENDER_FULL) ? $this->linkViewJS($mime_part, 'view_attach', htmlspecialchars($description), array('jstext' => sprintf(_("View %s"), $description), 'params' => $param_array)) : htmlspecialchars($description); } elseif ($mask & self::SUMMARY_DESCRIP_NOLINK) { -- 2.11.0