-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Missing space before evelope field of body structure
- Loading branch information
1 parent
0102ed7
commit dc67c10
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,51 @@ func TestHeaderOutOfBounds(t *testing.T) { | |
require.NoError(t, err) | ||
require.NotNil(t, parsed) | ||
} | ||
|
||
func TestStructureWithRFC822Embedded(t *testing.T) { | ||
const message = `Content-Type: multipart/mixed; | ||
boundary=dcd8fbdd2e8a8f95ac2024a5a57b37e2c24da4f0a0006ae059da17cb0e5b | ||
Return-Path: <[email protected]> | ||
X-Original-To: [email protected] | ||
Delivered-To: [email protected] | ||
References: <> | ||
Subject: Fwd: ISO-8859-1 | ||
To: [email protected] | ||
From: BQA <[email protected]> | ||
X-Forwarded-Message-Id: <> | ||
Message-Id: <[email protected]> | ||
Date: Wed, 2 Jun 2021 14:18:56 +0200 | ||
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 | ||
Thunderbird/78.10.2 | ||
Mime-Version: 1.0 | ||
In-Reply-To: <> | ||
Content-Language: en-US | ||
--dcd8fbdd2e8a8f95ac2024a5a57b37e2c24da4f0a0006ae059da17cb0e5b | ||
Content-Transfer-Encoding: quoted-printable | ||
Content-Type: text/plain; charset=utf-8 | ||
what | ||
--dcd8fbdd2e8a8f95ac2024a5a57b37e2c24da4f0a0006ae059da17cb0e5b | ||
Content-Disposition: attachment; filename=ISO-8859-1.eml | ||
Content-Type: message/rfc822; name=ISO-8859-1.eml | ||
From: [email protected] | ||
To: [email protected] | ||
Content-Type: text/plain; charset=iso-8859-1 | ||
Subject: ISO-8859-1 | ||
hey there bro | ||
--dcd8fbdd2e8a8f95ac2024a5a57b37e2c24da4f0a0006ae059da17cb0e5b-- | ||
` | ||
|
||
parsed, err := NewParsedMessage([]byte(message)) | ||
require.NoError(t, err) | ||
require.NotNil(t, parsed) | ||
|
||
expected := "((\"text\" \"plain\" (\"charset\" \"utf-8\") NIL NIL \"quoted-printable\" 6 2)(\"message\" \"rfc822\" (\"name\" \"ISO-8859-1.eml\") NIL NIL NIL 127 (NIL \"ISO-8859-1\" ((NIL NIL \"random-mail\" \"pm.me\")) ((NIL NIL \"random-mail\" \"pm.me\")) ((NIL NIL \"random-mail\" \"pm.me\")) ((NIL NIL \"random-mail2\" \"pm.me\")) NIL NIL NIL NIL)(\"text\" \"plain\" (\"charset\" \"iso-8859-1\") NIL NIL NIL 14 1) 6) \"mixed\")" | ||
require.Equal(t, expected, parsed.Body) | ||
} |