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

MailboxAddress.Parse throws unexpected ParseException for International Address #536

Closed
MrBreZe opened this issue Feb 10, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@MrBreZe
Copy link

MrBreZe commented Feb 10, 2020

Describe the bug
Prior to version 2.5.0 MailboxAddress.Parse("test.tä[email protected]") worked fine but now a ParseException is thrown.
MimeKit.ParseException
HResult=0x80131537
Message=Invalid address token at offset 0
Source=MimeKit
StackTrace:
at MimeKit.InternetAddress.TryParse(ParserOptions options, Byte[] text, Int32& index, Int32 endIndex, Int32 groupDepth, AddressParserFlags flags, InternetAddress& address) in InternetAddress.cs:

Platform:

  • OS: Windows
  • .NET Runtime: CoreCLR
  • .NET Framework: .Net Core 3.1
  • MimeKit Version: 2.5.0

To Reproduce
MailboxAddress parsed = MailboxAddress.Parse("test.tä[email protected]");

Expected behavior
MailboxAddress.Parse should be able to parse the text parameter even if it contains only one valid international email address and no name or any other information.

Additional context

new MailboxAddress("test.tä[email protected]") works fine and MailboxAddress.Parse works if i surround the international address with "<" ">" like "<test.tä[email protected]>".

i tried to narrow down the change that created that bug (2.4.1...2.5.0)
i am not sure but maybe it has something to do with commit Fixed mailbox address parser to be more lenient about []'s in the dis…

PS: Thank you soooo much for this awesome library (mailkit + mimekit)

@The-Nutty
Copy link

I have also observed issues with MailboxAddress.Parse after 2.5.0, previously MailboxAddress.Parse("​[email protected]") would work fine (notice the zero width space at the front of the email address) where as with 2.5.0 its now throwing the following exception:

MimeKit.ParseException: Invalid address token at offset 0
  at MimeKit.InternetAddress.TryParse(ParserOptions options, Byte[] text, Int32& index, Int32 endIndex, Int32 groupDepth, AddressParserFlags flags, InternetAddress& address)
  at MimeKit.MailboxAddress.Parse(ParserOptions options, String text)

Im assuming this issue is related how i can create another issue if you believe it is not.

@jstedfast
Copy link
Owner

@The-Nutty I suspect that you are correct believing that it is related.

I'll try to dig into this soon.

jstedfast added a commit that referenced this issue Feb 12, 2020
@jstedfast
Copy link
Owner

Turns out it was a trivial bug/fix ;-)

I added unit tests to cover both of these examples and they are both passing now.

Thanks for the bug report, guys!

@jstedfast jstedfast added the bug Something isn't working label Feb 12, 2020
@jstedfast
Copy link
Owner

jstedfast commented Feb 15, 2020

Just released MimeKit 2.5.1 with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants