Bug 1525120 - Follow-up: Drop special casing for message attachments. r=AlfredPeters
authorJorg K <jorgk@jorgk.com>
Sat, 23 Feb 2019 22:15:20 +0100
changeset 34623 fd2a34cf700c3e084298b57287c51e7f0475a76d
parent 34622 0f2d593533f8eca2a2840c27d0cd8b7ca3f8c6f0
child 34624 50e9f0078bdd944fbff7b8fe88b9a5bacab3121d
push id390
push userclokep@gmail.com
push dateMon, 20 May 2019 17:04:42 +0000
reviewersAlfredPeters
bugs1525120
Bug 1525120 - Follow-up: Drop special casing for message attachments. r=AlfredPeters
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'. */