-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/0.72.0' into master
- Loading branch information
Showing
7 changed files
with
123 additions
and
30 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
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 |
---|---|---|
|
@@ -318,6 +318,55 @@ Bob Smith<[email protected]> | |
--xYzZY | ||
Content-Disposition: form-data; name=""attachments"" | ||
0 | ||
--xYzZY--"; | ||
|
||
private const string INBOUND_EMAIL_UNUSUAL_ENCODING_WEBHOOK = @"--xYzZY | ||
Content-Disposition: form-data; name=""dkim"" | ||
{@hotmail.com : pass} | ||
--xYzZY | ||
Content-Disposition: form-data; name=""envelope"" | ||
{""to"":[""[email protected]""],""from"":""[email protected]""} | ||
--xYzZY | ||
Content-Disposition: form-data; name=""subject"" | ||
Test #1 | ||
--xYzZY | ||
Content-Disposition: form-data; name=""charsets"" | ||
{""to"":""UTF-8"",""html"":""us-ascii"",""subject"":""UTF-8"",""from"":""UTF-8"",""text"":""iso-8859-10""} | ||
--xYzZY | ||
Content-Disposition: form-data; name=""SPF"" | ||
softfail | ||
--xYzZY | ||
Content-Disposition: form-data; name=""to"" | ||
""Test Recipient"" <[email protected]> | ||
--xYzZY | ||
Content-Disposition: form-data; name=""html"" | ||
<html><body><strong>Hello SendGrid!</body></html> | ||
--xYzZY | ||
Content-Disposition: form-data; name=""from"" | ||
Bob Smith<[email protected]> | ||
--xYzZY | ||
Content-Disposition: form-data; name=""text"" | ||
Hello SendGrid! | ||
--xYzZY | ||
Content-Disposition: form-data; name=""sender_ip"" | ||
10.43.24.23 | ||
--xYzZY | ||
Content-Disposition: form-data; name=""attachments"" | ||
0 | ||
--xYzZY--"; | ||
|
||
|
@@ -503,6 +552,30 @@ public async Task RawPayloadWithAttachmentsAsync() | |
} | ||
} | ||
|
||
[Fact] | ||
public void InboundEmail_with_unusual_encoding() | ||
{ | ||
// Arrange | ||
var parser = new WebhookParser(); | ||
using (var stream = GetStream(INBOUND_EMAIL_UNUSUAL_ENCODING_WEBHOOK)) | ||
{ | ||
// Act | ||
var inboundEmail = parser.ParseInboundEmailWebhook(stream); | ||
|
||
// Assert | ||
inboundEmail.Charsets.ShouldNotBeNull(); | ||
inboundEmail.Charsets.Except(new[] | ||
{ | ||
new KeyValuePair<string, Encoding>("to", Encoding.UTF8), | ||
new KeyValuePair<string, Encoding>("subject", Encoding.UTF8), | ||
new KeyValuePair<string, Encoding>("from", Encoding.UTF8), | ||
new KeyValuePair<string, Encoding>("html", Encoding.ASCII), | ||
new KeyValuePair<string, Encoding>("text", Encoding.UTF8) // The original encoding is iso-8859-10 but we fallback on UTF-8 | ||
}).Count().ShouldBe(0); | ||
inboundEmail.Text.ShouldBe("Hello SendGrid!\r\n"); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void Parse_processed_JSON() | ||
{ | ||
|
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
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