Bug 1525120 - Follow-up: Drop special casing for message attachments. r=AlfredPeters a=jorgk
authorJorg K <jorgk@jorgk.com>
Sat, 23 Feb 2019 22:15:20 +0100
changeset 34363 9d13f6b3d446
parent 34362 d266b1bedba1
child 34364 df1d9106a00f
push id389
push userclokep@gmail.com
push dateMon, 18 Mar 2019 19:01:53 +0000
reviewersAlfredPeters, jorgk
bugs1525120
Bug 1525120 - Follow-up: Drop special casing for message attachments. r=AlfredPeters a=jorgk
mailnews/mime/src/mimeleaf.cpp
--- a/mailnews/mime/src/mimeleaf.cpp
+++ b/mailnews/mime/src/mimeleaf.cpp
@@ -89,35 +89,33 @@ MimeLeaf_parse_begin (MimeObject *obj)
 {
   MimeLeaf *leaf = (MimeLeaf *) obj;
   MimeDecoderData *(*fn) (MimeConverterOutputCallback, void*) = 0;
 
   /* Initialize a decoder if necessary.
    */
   if (!obj->encoding ||
       // If we need the object as "raw" for saving or forwarding,
-      // don't decode text parts of message types. Other output formats,
-      // like "display" (nsMimeMessageBodyDisplay), need decoding.
+      // don't decode attachment parts if headers are also written
+      // via the parent, so that the header matches the encoding.
       (obj->options->format_out == nsMimeOutput::nsMimeMessageRaw &&
-       obj->parent && obj->parent->output_p &&
-       (!PL_strcasecmp(obj->parent->content_type, MESSAGE_NEWS) ||
-        !PL_strcasecmp(obj->parent->content_type, MESSAGE_RFC822))))
+       obj->parent && obj->parent->output_p))
     /* no-op */ ;
   else if (!PL_strcasecmp(obj->encoding, ENCODING_BASE64))
-  fn = &MimeB64DecoderInit;
+    fn = &MimeB64DecoderInit;
   else if (!PL_strcasecmp(obj->encoding, ENCODING_QUOTED_PRINTABLE))
-  leaf->decoder_data =
+    leaf->decoder_data =
           MimeQPDecoderInit(((MimeConverterOutputCallback)
                         ((MimeLeafClass *)obj->clazz)->parse_decoded_buffer),
                         obj, obj);
   else if (!PL_strcasecmp(obj->encoding, ENCODING_UUENCODE) ||
        !PL_strcasecmp(obj->encoding, ENCODING_UUENCODE2) ||
        !PL_strcasecmp(obj->encoding, ENCODING_UUENCODE3) ||
        !PL_strcasecmp(obj->encoding, ENCODING_UUENCODE4))
-  fn = &MimeUUDecoderInit;
+    fn = &MimeUUDecoderInit;
   else if (!PL_strcasecmp(obj->encoding, ENCODING_YENCODE))
     fn = &MimeYDecoderInit;
 
   if (fn)
   {
     leaf->decoder_data =
     fn (/* The MimeConverterOutputCallback cast is to turn the `void' argument
            into `MimeObject'. */