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

Fix for certain charset duplicate params error #19

Merged
merged 4 commits into from
Dec 30, 2016

Conversation

deepakprabhakara
Copy link
Contributor

If a duplicate param is present then parsing of the entire email fails. This fix handles a misplaced ";" in content-type. It also handles empty name in content-type. I have also added a unit test for this scenario.

…l mime parsing fails.

- Handle misplaced ; in content-type
- Handle empty name in content-type
- Added a test
@coveralls
Copy link

coveralls commented Dec 30, 2016

Coverage Status

Coverage decreased (-0.3%) to 83.822% when pulling dffdf24 on redsift:duplicate-params-fix into fd87f75 on jhillyerd:master.

@jhillyerd
Copy link
Owner

It seems like your new error path for missing ; is not being tested: https://coveralls.io/builds/9466465/source?filename=part.go#L233 can you add another MIME part to exercise that?

@deepakprabhakara
Copy link
Contributor Author

@jhillyerd Nice catch, didn't know about coveralls. 👍

@coveralls
Copy link

coveralls commented Dec 30, 2016

Coverage Status

Coverage increased (+0.2%) to 84.328% when pulling 88c79e8 on redsift:duplicate-params-fix into fd87f75 on jhillyerd:master.

@coveralls
Copy link

coveralls commented Dec 30, 2016

Coverage Status

Coverage increased (+0.4%) to 84.53% when pulling 802c61b on redsift:duplicate-params-fix into fd87f75 on jhillyerd:master.

@deepakprabhakara
Copy link
Contributor Author

@jhillyerd Done. Please review.

@deepakprabhakara
Copy link
Contributor Author

deepakprabhakara commented Dec 30, 2016

@jhillyerd mime.ParseMediaType is used in several places. I think a better fix is to create a function parseMediaType which can then call mime.ParseMediaType and then if that fails call parseBadContentType. This will cover duplicate parameters fixes across Content-Type everywhere (envelope, parts, etc.). Thoughts?

I'll update this PR soon.

@coveralls
Copy link

coveralls commented Dec 30, 2016

Coverage Status

Coverage increased (+0.5%) to 84.639% when pulling 8489d44 on redsift:duplicate-params-fix into fd87f75 on jhillyerd:master.

@jhillyerd
Copy link
Owner

Looks great, thank you!

@jhillyerd jhillyerd merged commit ec51e5c into jhillyerd:master Dec 30, 2016
jhillyerd added a commit that referenced this pull request Jun 20, 2023
If charset is missing from the mime header look for it in the html meta tag
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.

3 participants