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;
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;