Fix compose_attach_preview.
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 25 Nov 2008 00:03:35 +0000 (17:03 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 25 Nov 2008 00:03:35 +0000 (17:03 -0700)
imp/view.php

index a42ac4c..7756083 100644 (file)
@@ -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');