Skip to content

fix: fix for quote-printed utf-8 header with quotes #237

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

Conversation

dmytrokasianenko-outreach
Copy link
Contributor

@dmytrokasianenko-outreach dmytrokasianenko-outreach commented Mar 3, 2022

This PR fixes decoding addresses with quotes.
For example, "=?UTF-8?Q?Miros=C5=82aw_Marczak?=" should be decoded as Mirosław Marczak.

@dmytrokasianenko-outreach dmytrokasianenko-outreach force-pushed the dmytrokasianenko-outreach/fix/address-list branch from e235d2d to a21d370 Compare March 3, 2022 17:49
@jhillyerd
Copy link
Owner

I think this may revert the fix for #218 by decoding the 2047 words too early.

@jhillyerd
Copy link
Owner

jhillyerd commented Mar 6, 2022

Thinking about how to get better test coverage for this, without introducing a bunch more file based envelope tests:

We could copy https://github.com/jhillyerd/enmime/blob/master/header_test.go#L60 (TestParseAddressListResult) to envelope_test.go, then modify it to create a minimal message, putting the input values on the To: line, parsing into an envelope and then checking what the To field contains.

@dmytrokasianenko-outreach dmytrokasianenko-outreach force-pushed the dmytrokasianenko-outreach/fix/address-list branch 2 times, most recently from a408d4b to c5f9660 Compare March 7, 2022 14:09
@dmytrokasianenko-outreach dmytrokasianenko-outreach force-pushed the dmytrokasianenko-outreach/fix/address-list branch from c5f9660 to 137fc73 Compare March 7, 2022 14:12
@dmytrokasianenko-outreach
Copy link
Contributor Author

You are right, it was breaking the the fix for #218.

I've changed solution by trying to additionally decode address.Name with mime.WordDecoder. It works fine for the test cases, however I'm not sure it is a valid one. What do you think?

@dmytrokasianenko-outreach
Copy link
Contributor Author

I've added a fix for ParseAddressList to be able to decode different charsets

@jhillyerd
Copy link
Owner

I'll try and take a deeper look at the address.Name decoding in the next few days, thanks

@jhillyerd
Copy link
Owner

I think this is a good, thanks for your work on this!

@jhillyerd jhillyerd merged commit 3d42481 into jhillyerd:master Mar 13, 2022
@dmytrokasianenko-outreach dmytrokasianenko-outreach deleted the dmytrokasianenko-outreach/fix/address-list branch March 14, 2022 08:59
@dmytrokasianenko-outreach
Copy link
Contributor Author

thank you for all your work!

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 this pull request may close these issues.

None yet

2 participants