Bug 1227761 - Fix logic error in BuildAttachmentList().

First attachment cannot be saved if MIME message has no body part.

Tag #1273
This commit is contained in:
Matt A. Tobin 2019-11-10 18:13:59 -05:00 • committed by Roy Tam
commit f14a669d8b

View file

@ -529,13 +529,14 @@ BuildAttachmentList(MimeObject *anObject, nsMsgAttachmentData *aAttachData, cons
skip = false; skip = false;
if (skip && child->headers) if (skip && child->headers)
{ {
char * disp = MimeHeaders_get (child->headers, // If it has a filename, we don't skip it regardless of the
HEADER_CONTENT_DISPOSITION, // content disposition which can be "inline" or "attachment".
true, false); // Inline parts are not shown when attachments aren't displayed
if (MimeHeaders_get_name(child->headers, nullptr) && // inline, so the only chance to see the part is as attachment.
(!disp || PL_strcasecmp(disp, "attachment"))) char * name = MimeHeaders_get_name(child->headers, nullptr);
// it has a filename and isn't being displayed inline if (name)
skip = false; skip = false;
PR_FREEIF(name);
} }
found_output = true; found_output = true;