Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Improve parsing of MIME parameter part #1

Open
wants to merge 2 commits into
base: upstream
Choose a base branch
from

Conversation

thomasst
Copy link
Member

@thomasst thomasst commented Nov 1, 2019

Like mailgun#103, but also prevents concatenating splitted and unsplitted params.

stefanw and others added 2 commits November 1, 2019 16:37
Fix problem where single encoded + unencoded MIME parameter
of same name get concatenated.
@thomasst thomasst self-assigned this Nov 1, 2019
Copy link
Member

@jkemp101 jkemp101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lgtm but should we delete this fork and re-fork directly from https://github.com/mailgun/flanker? Might make it easier to get this merged upstream after we run it for a bit.

@@ -107,8 +107,11 @@ def concatenate(parts):
if is_old_style(part):
# old-style parameters do not support any continuations
return encodedword.mime_to_unicode(get_value(part))

return ''.join(decode_new_style(p) for p in partition(parts))
elif is_single_part(part):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to noodle through all of this for a bit to understand what it was now doing. We should probably enhance the docstring for this function that includes these two new formats it now supports.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants