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 in multipart parsing #411

Open
g-regor opened this issue Jul 23, 2022 · 2 comments
Open

Bug in multipart parsing #411

g-regor opened this issue Jul 23, 2022 · 2 comments

Comments

@g-regor
Copy link

g-regor commented Jul 23, 2022

Multipart mime types are improperly parsed. By standard, the last boundary has "--" appended, which the parser doesn't account to. This produces an erroneous mime part with only "--".

MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="===============0438762424560383716=="
Subject: Subject
From: sender@localhost
To: receiver@localhost
Date: Sat, 23 Jul 2022 18:08:29 -0000
Message-Id: <165859970975.49072.13986632326735601263@localhost>

--===============0438762424560383716==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit

Text message

--===============0438762424560383716==
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0

<!doctype html><html><body><b>HTML</b> message</body></html>

--===============0438762424560383716==--

The above email produces 3 mime parts.

image

@g-regor
Copy link
Author

g-regor commented Jul 23, 2022

Packages "net/mail" and "mime/multipart" should be used for parsing.

@g-regor
Copy link
Author

g-regor commented Jul 24, 2022

Looks like there is an existing pull request about this from 5 year ago.

mailhog/data#5

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

No branches or pull requests

1 participant