Bug 580017 - Base64 encoded EML files in attachments can't be opened ("Empty attachments" by open, "Save As" does do nothing). r=bienvenu
--- a/mailnews/mime/src/mimei.cpp
+++ b/mailnews/mime/src/mimei.cpp
@@ -890,16 +890,29 @@ mime_create (const char *content_type, M
{
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);
+ // Workaroung for saving '.eml" file encoded with base64.
+ // Do not override with message/rfc822 whenever Transfer-Encoding is
+ // base64 since base64 encoding of message/rfc822 is invalid.
+ // Our MimeMessageClass has no capability to decode it.
+ if (!PL_strcasecmp(override_content_type, MESSAGE_RFC822)) {
+ nsCString encoding;
+ encoding.Adopt(MimeHeaders_get(hdrs,
+ HEADER_CONTENT_TRANSFER_ENCODING,
+ true, false));
+ if (encoding.EqualsLiteral(ENCODING_BASE64))
+ override_content_type = nsnull;
+ }
+
// 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;
}
}