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

Improve parsing of MIME parameter part #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stefanw
Copy link

@stefanw stefanw commented Sep 8, 2015

I have mails with MIME headers like this:

Content-Type: application/pdf; name=30676_2015.pdf;name*=iso-8859-1''%33%30%36%37%36%5F%32%30%31%35%2E%70%64%66
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=30676_2015.pdf;
 filename*=iso-8859-1''%33%30%36%37%36%5F%32%30%31%35%2E%70%64%66

The parameter name and filename are present as single encoded and single unencoded. This leads to an interpretation as a parameter continuation and to a concatenation of the values so that the result would be "30676_2015.pdf30676_2015.pdf".

I added code to avoid joining parameter values of the same name if they are not actually continuations, but just different encodings of the same value. Test is included!

@mailgun-ci
Copy link

Can one of the admins verify this patch?

@stefanw
Copy link
Author

stefanw commented Dec 2, 2015

Any news on this? Should be an easy-picking!

@mailgun-ci
Copy link

Can one of the admins verify this patch?

Fix problem where single encoded + unencoded MIME parameter
of same name get concatenated.
@stefanw stefanw force-pushed the same-param-encoded-unencoded branch from c38b320 to 834c850 Compare October 30, 2017 12:37
thomasst added a commit to closeio/flanker-new that referenced this pull request Mar 20, 2020
- Fix problem where single encoded + unencoded MIME parameter of same name get concatenated (thanks to @stefanw at mailgun/flanker#103)

- Prevent concatenating any splitted and unsplitted parameters

- Improve docstring of concatenate()
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.

2 participants