From 1ec388b2383aa1540961843847d3af32174a248d Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 10 Nov 2019 18:13:59 -0500 Subject: Bug 1227761 - Fix logic error in BuildAttachmentList(). First attachment cannot be saved if MIME message has no body part. Tag #1273 --- mailnews/mime/src/mimemoz2.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/mailnews/mime/src/mimemoz2.cpp b/mailnews/mime/src/mimemoz2.cpp index 09ac52545..c47c5c8a5 100644 --- a/mailnews/mime/src/mimemoz2.cpp +++ b/mailnews/mime/src/mimemoz2.cpp @@ -529,13 +529,14 @@ BuildAttachmentList(MimeObject *anObject, nsMsgAttachmentData *aAttachData, cons skip = false; if (skip && child->headers) { - char * disp = MimeHeaders_get (child->headers, - HEADER_CONTENT_DISPOSITION, - true, false); - if (MimeHeaders_get_name(child->headers, nullptr) && - (!disp || PL_strcasecmp(disp, "attachment"))) - // it has a filename and isn't being displayed inline - skip = false; + // If it has a filename, we don't skip it regardless of the + // content disposition which can be "inline" or "attachment". + // Inline parts are not shown when attachments aren't displayed + // inline, so the only chance to see the part is as attachment. + char * name = MimeHeaders_get_name(child->headers, nullptr); + if (name) + skip = false; + PR_FREEIF(name); } found_output = true; -- cgit v1.2.3