don't try to open apple double attachments as apple double, r=standard8, bug 579682, and don't make attachments disappear when apple double registered as content type
authorDavid Bienvenu <bienvenu@nventure.com>
Mon, 13 Dec 2010 09:08:48 -0800
changeset 6828 870f6de6d857
parent 6827 9d7a6096be80
child 6829 d1e3e4add0fe
push id5236
push userbienvenu@nventure.com
push dateMon, 13 Dec 2010 17:08:24 +0000
treeherdercomm-central@870f6de6d857 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8, bug
bugs579682
don't try to open apple double attachments as apple double, r=standard8, bug 579682, and don't make attachments disappear when apple double registered as content type
mailnews/mime/src/mimei.cpp
mailnews/mime/src/mimemoz2.cpp
--- a/mailnews/mime/src/mimei.cpp
+++ b/mailnews/mime/src/mimei.cpp
@@ -861,16 +861,20 @@ mime_create (const char *content_type, M
     (!content_type ||
      !PL_strcasecmp(content_type, APPLICATION_OCTET_STREAM) ||
      !PL_strcasecmp(content_type, UNKNOWN_CONTENT_TYPE)))
   {
     char *name = MimeHeaders_get_name(hdrs, opts);
     if (name)
     {
       override_content_type = opts->file_type_fn (name, opts->stream_closure);
+      // appledouble isn't a valid override content type, and makes
+      // attachments invisible.
+      if (!PL_strcasecmp(override_content_type, MULTIPART_APPLEDOUBLE))
+        override_content_type = nsnull;
       PR_FREEIF(name);
 
       // If we get here and it is not the unknown content type from the
       // file name, let's do some better checking not to inline something bad
       if (override_content_type &&
           *override_content_type &&
           (PL_strcasecmp(override_content_type, UNKNOWN_CONTENT_TYPE)))
         content_type = override_content_type;
--- a/mailnews/mime/src/mimemoz2.cpp
+++ b/mailnews/mime/src/mimemoz2.cpp
@@ -399,16 +399,19 @@ GenerateAttachmentData(MimeObject *objec
       if (isAnAppleDoublePart)
         // the data fork is the 2nd part, and we should ALWAYS look there first for the file name
         for (i = 1; i >= 0 && !tmp->real_name; i --)
         {
           PR_FREEIF(disp);
           nsMemory::Free(charset);
           disp = MimeHeaders_get(((MimeContainer *)object)->children[i]->headers, HEADER_CONTENT_TYPE, PR_FALSE, PR_FALSE);
           tmp->real_name = MimeHeaders_get_parameter(disp, "name", &charset, nsnull);
+          tmp->real_type =
+            MimeHeaders_get(((MimeContainer *)object)->children[i]->headers,
+                            HEADER_CONTENT_TYPE, PR_TRUE, PR_FALSE);
         }
 
       if (tmp->real_name)
       {
         // check encoded type
         //
         // The parameter of Content-Disposition must use RFC 2231.
         // But old Netscape 4.x and Outlook Express etc. use RFC2047.