Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: mimeTree rebuilding does not join boundaries by a line break delimiter (e.g. \r\n) #571

Closed
titanism opened this issue Dec 5, 2023 · 6 comments · Fixed by #573
Closed

Comments

@titanism
Copy link
Contributor

titanism commented Dec 5, 2023

Can we make it so the mimeTree when rebuilt has proper line breaks with boundaries?

Before WildDuck:

Content-Type: multipart/mixed; boundary="------------cWFvDSey27tFG0hVYLqp9hs9"
MIME-Version: 1.0
Message-ID: <[email protected]>
To: [email protected]
From: [email protected]
Subject: test

This is a multi-part message in MIME format.
--------------cWFvDSey27tFG0hVYLqp9hs9
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

test

--------------cWFvDSey27tFG0hVYLqp9hs9
Content-Type: text/plain; charset=UTF-8; name="example.txt"
Content-Disposition: attachment; filename="example.txt"
Content-Transfer-Encoding: base64

ZXhhbXBsZQo=

--------------cWFvDSey27tFG0hVYLqp9hs9--

After WildDuck:

Content-Type: multipart/mixed; boundary="------------cWFvDSey27tFG0hVYLqp9hs9"
MIME-Version: 1.0
Message-ID: <[email protected]>
To: [email protected]
From: [email protected]
Subject: test

This is a multi-part message in MIME format.--------------cWFvDSey27tFG0hVYLqp9hs9 // <-------- RIGHT HERE
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

test

--------------cWFvDSey27tFG0hVYLqp9hs9
Content-Type: text/plain; charset=UTF-8; name="example.txt"
Content-Disposition: attachment; filename="example.txt"
Content-Transfer-Encoding: base64


--------------cWFvDSey27tFG0hVYLqp9hs9--

You can see the difference with the line break before boundary delimiter.

@titanism
Copy link
Contributor Author

titanism commented Dec 5, 2023

@andris9 PR submitted to fix this at #572

@andris9
Copy link
Member

andris9 commented Dec 5, 2023

Seems to be an issue with the parser 🤔

@andris9
Copy link
Member

andris9 commented Dec 7, 2023

This specific parser bug triggers if the email does not end with a linebreak character. How did you get this email? Any email received via SMTP always ends with a linebreak?

@andris9
Copy link
Member

andris9 commented Dec 7, 2023

In any case, I verified it, and it is a legitimate bug. It should be extremely rare in production, as emails always end with a linebreak unless you compose an email manually and use APPEND to upload it. I guess this is why it hasn't been discovered before - you need a multipart email with no-multipart text content and without an ending linebreak.

@andris9
Copy link
Member

andris9 commented Dec 7, 2023

But the issue is not on the composing side, but on the parsing side. The composer behaves correctly.

@titanism
Copy link
Contributor Author

titanism commented Dec 7, 2023

Thank you @andris9, excited to try this out in the v1.41.1 release #573! 🎉 🙏 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants