From 5cc4b13a0c6d32d74d0cba17feeb6c5fbceaf25f Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Mon, 19 Mar 2007 18:36:24 -0400
Subject: [PATCH] Correctly parse message/rfc822; fixed html2text conversion; code cleanup

---
 program/steps/mail/get.inc |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc
index 521f477..11688f1 100644
--- a/program/steps/mail/get.inc
+++ b/program/steps/mail/get.inc
@@ -59,16 +59,12 @@
     {
     $ctype_primary = strtolower($part->ctype_primary);
     $ctype_secondary = strtolower($part->ctype_secondary);
-
     $mimetype = sprintf('%s/%s', $ctype_primary, $ctype_secondary);
-    $filename = $part->d_parameters['filename'] ? $part->d_parameters['filename'] : $part->ctype_parameters['name'];
 
     header("Expires: 0");
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     header("Cache-Control: private", false);
     header("Content-Transfer-Encoding: binary");
-    header(sprintf('Content-Disposition: attachment; filename="%s";',
-                   $filename ? rcube_imap::decode_mime_string($filename) : "roundcube.$ctype_secondary"));
 
     // send download headers
     if ($_GET['_download'])
@@ -110,6 +106,10 @@
       }
     else
       {
+      header(sprintf('Content-Disposition: %s; filename="%s";',
+                     $part->disposition ? $part->disposition : 'attachment',
+                     $part->filename ? $part->filename : "roundcube.$ctype_secondary"));
+
       // turn off output buffering and print part content
       $IMAP->get_message_part($MESSAGE['UID'], $part->mime_id, $part->encoding, true);
       }

--
Gitblit v1.9.1