[dev] [patch] to fix imp cancel message with attachments problem

Rich Bartell rwb at bartellonline.com
Sat Oct 23 11:56:10 PDT 2004


I recently discovered what I think is a bug in imp's handling of messages 
with attachments that are canceled via the "Cancel Message" button in the 
compose window. I think the attached small patch to the 
imp-RELENG-2004-10-23 snapshot fixes it.

I basically discovered the problem when I decided to cancel a message that 
had an attachment, with the option set to compose in the same window 
rather than in a popup window.  When the system returned to the INBOX view 
after I'd pressed the "Cancel Message" button, I had a brief moment of 
panic when a "Message Sent Successfully" confirmation appeared.  I checked 
the server logs, and to my relief the message had in fact not been sent, 
so the confirmation message was erroneous.

Another symptom of the same bug is that the impatt* files (the 
attachments) for the cancelled message are kept in the /tmp directory and 
not deleted when the message is cancelled.

Upon digging into the code, I noticed a difference in how the javascript 
code for the cancel function was created between those composing in a 
popup window (which worked) and those composing in the same window (which 
didn't).  Making the latter set the URL the same way as the former (i.e. 
for the compose.php program to call itself again to delete the 
attachments) seems to fix the problem.

Hope this helps,
Rich
-------------- next part --------------
--- compose.php.orig	2004-10-23 22:48:36.000000000 +0500
+++ compose.php	2004-10-23 22:49:40.000000000 +0500
@@ -1156,7 +1156,7 @@
     /* If the attachments list is not empty, we must reload this page and
        delete the attachments. */
     if (!empty($_POST['attachments_file'])) {
-        $url = IMP::addParameter(mailboxReturnUrl(Horde::selfUrl()), 'actionID=' . CANCEL_COMPOSE);
+        $url = IMP::addParameter(Horde::selfUrl(), 'actionID=' . CANCEL_COMPOSE);
         $url = IMP::addParameter($url, 'files=' . rawurlencode(serialize($_POST['attachments_file'])));
         $cancel_js = 'window.location = \'' . $url . '\';';
     } else {


More information about the dev mailing list