Fix Content-Disposition header output when building MIME data.
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 26 Apr 2010 07:23:19 +0000 (01:23 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 26 Apr 2010 07:32:01 +0000 (01:32 -0600)
framework/Mime/lib/Horde/Mime/Part.php

index 738d5b6..98ac9da 100644 (file)
@@ -921,14 +921,17 @@ class Horde_Mime_Part
             return $headers;
         }
 
-        /* Don't show Content-Disposition for multipart messages unless
-         * there is a name parameter. RFC 2183 [2] indicates that default is
-         * no requested disposition. */
+        /* Don't show Content-Disposition unless a disposition has explicitly
+         * been set or there is a name parameter. If there is a name, but no
+         * disposition, default to 'attachment'.
+         * RFC 2183 [2] indicates that default is no requested disposition -
+         * the receiving MUA is responsible for display choice. */
         $disposition = $this->getDisposition();
         $name = $this->getName();
-        if (($ptype != 'multipart') ||
-            ($disposition || !empty($name))) {
-            $headers->replaceHeader('Content-Disposition', $disposition, array('params' => (!empty($name) ? array('filename' => $name) : array())));
+        if ($disposition || !empty($name)) {
+            $headers->replaceHeader('Content-Disposition', $disposition ? $disposition : 'attachment', array('params' => (!empty($name) ? array('filename' => $name) : array())));
+        } else {
+            $headers->removeHeader('Content-Disposition');
         }
 
         /* Add transfer encoding information. RFC 2045 [6.1] indicates that