-
Notifications
You must be signed in to change notification settings - Fork 51
Description
The following scenario was known to be problematic in FlowCrypt, but is is fixed now using the following code:
} else if (Mime.getNodeType(node) === 'text/html' && !Mime.getNodeFilename(node)) {
// html content may be broken up into smaller pieces by attachments in between
// AppleMail does this with inline attachments
mimeContent.html = (mimeContent.html || '') + Mime.getNodeContentAsUtfStr(node);
} else if (Mime.getNodeType(node) === 'text/plain' && (!Mime.getNodeFilename(node) || Mime.isNodeInline(node))) {
mimeContent.text = (mimeContent.text ? `${mimeContent.text}\n\n` : '') + Mime.getNodeContentAsUtfStr(node);
Originally the code said something like mimeContent.html = Mime.getNodeContentAsUtfStr(node);
- so if there were two html nodes, originally the second node overwrote the first, and a bunch of content got lost before it was rendered.
The result was that if we received the following MIME structure in pgp/mime email
Hello, this is my message
[attachment.txt]
Anyway, see you soon
Or more specifically when replying:
Hello, this is my reply to your earlier message, with an attachment
[attachment.txt]
On 2020-01-01 [email protected] said:
> this was the original message
Then FlowCrypt would only show the part below the attachment. half the message (or even whole original message, if the other half below the attachment is quoted text) got lost.
While the issue itself is fixed, I don't think we have any good test for it. There is a test in flowcrypt.compatibility
account titled Re: response with asnwer, attachment, and quoted text below
. I'm not 100% sure if this email indeed captures the originally broken behavior, but I think it does.
You may want to test this - change the code back to as I indicated above, and see if the rendered email is any different (for example, the message body missing, only showing quoted part). If yes, then this message is good to use for a test case. Please write a test case that ensures we don't break this in the future.