Fix the way attachments are displayed in multipart messages
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Fri, 4 May 2007 21:34:49 +0000 (21:34 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:35:39 +0000 (00:35 +0100)
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@244 9869982d-c50d-0410-be91-f2a2ec7c7c7b

banana/mimepart.inc.php

index 18ba4c0..81a593a 100644 (file)
@@ -50,8 +50,8 @@ class BananaMimePart
         $this->id           = $id;
         if (is_null($content_type) || $content_type == 'application/octet-stream') {
             $this->decodeContent();
-            $this->content_type = BananaMimePart::getMimeType($body, false);
-        }   
+            $this->content_type = BananaMimePart::getMimeType($this->body, false);
+        }
     }
 
     protected function makeFilePart($file, $content_type =null, $disposition = 'attachment')
@@ -423,8 +423,9 @@ class BananaMimePart
                                                                     'artid' => Banana::$artid,
                                                                     'part'  => $part)))
                  . '" alt="' . banana_htmlentities($this->filename) . '" />';
-        } elseif (!in_array($type, Banana::$msgshow_mimeparts)
-                  && !in_array($this->content_type, Banana::$msgshow_mimeparts)) {
+        } elseif ((!in_array($type, Banana::$msgshow_mimeparts)
+                  && !in_array($this->content_type, Banana::$msgshow_mimeparts))
+                  || $this->disposition == 'attachment') {
             $part = $this->id ? $this->id : $this->filename;
             if (!$part) {
                 $part = $this->content_type;