From 433520b05b5253ce4c152b10341207a163d25c3d Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 24 Nov 2008 17:03:35 -0700 Subject: [PATCH] Fix compose_attach_preview. --- imp/view.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/imp/view.php b/imp/view.php index a42ac4c2d..775608306 100644 --- a/imp/view.php +++ b/imp/view.php @@ -49,8 +49,8 @@ $session_control = 'readonly'; require_once IMP_BASE . '/lib/base.php'; $actionID = Util::getFormData('actionID'); -$id = Util::getFormData('id'); $ctype = Util::getFormData('ctype'); +$id = Util::getFormData('id'); /* 'compose_attach_preview' doesn't use IMP_Contents since there is no * IMAP message data - rather, we must use the IMP_Compose object to @@ -59,12 +59,15 @@ if ($actionID == 'compose_attach_preview') { /* Initialize the IMP_Compose:: object. */ $imp_compose = &IMP_Compose::singleton(Util::getFormData('composeCache')); $mime = $imp_compose->buildAttachment($id); + if (empty($mime, 'PEAR_Error')) { + Horde::fatal('Could not load attachment', __FILE__, __LINE__); + } - /* Create a dummy IMP_Contents() object so we can use the view - * code below. Then use the 'view_attach' handler to output to - * the user. */ + /* Create a dummy IMP_Contents() object so we can use the view code below. + * Then use the 'view_attach' handler to output. */ $contents = new IMP_Contents($mime); $actionID = 'view_attach'; + $id = $mime->getMimeId(); } else { $index = Util::getFormData('index'); $mailbox = Util::getFormData('mailbox'); -- 2.11.0