Skip to content

Commit

Permalink
Merge pull request #161 from mailgun/brendan/quote-then-encode
Browse files Browse the repository at this point in the history
Quote display names before encoding them
  • Loading branch information
b0d0nne11 committed Jun 15, 2017
2 parents 3495320 + bcc9186 commit f9e4ff0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions flanker/addresslib/address.py
Expand Up @@ -529,8 +529,8 @@ def display_name(self):

@property
def ace_display_name(self):
return smart_quote(encode_string(None, self.display_name,
maxlinelen=MAX_ADDRESS_LENGTH))
return encode_string(None, smart_quote(self.display_name),
maxlinelen=MAX_ADDRESS_LENGTH)

@property
def mailbox(self):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -4,7 +4,7 @@


setup(name='flanker',
version='0.6.14',
version='0.6.15',
description='Mailgun Parsing Tools',
long_description=open('README.rst').read(),
classifiers=[],
Expand Down
12 changes: 12 additions & 0 deletions tests/addresslib/address_test.py
Expand Up @@ -339,6 +339,18 @@ def test_address_convertible_2_ascii():
'str': u'Foo@mail.comñ'.encode('utf-8'),
'unicode': u'Федот <Foo@mail.comñ>',
'full_spec': '=?utf-8?b?0KTQtdC00L7Rgg==?= <Foo@mail.xn--com-9ma>',
}, {
'desc': 'display_name=quoted-utf8-with-specials, domain=ascii',
'addr': u'"Федот @ Федот" <Foo@Bar.com>',

'display_name': u'Федот @ Федот',
'ace_display_name': '=?utf-8?b?ItCk0LXQtNC+0YIgQCDQpNC10LTQvtGCIg==?=',
'address': u'Foo@bar.com',
'ace_address': 'Foo@bar.com',
'repr': u'"Федот @ Федот" <Foo@bar.com>'.encode('utf-8'),
'str': u'Foo@bar.com'.encode('utf-8'),
'unicode': u'"Федот @ Федот" <Foo@bar.com>',
'full_spec': '=?utf-8?b?ItCk0LXQtNC+0YIgQCDQpNC10LTQvtGCIg==?= <Foo@bar.com>',
}]):
print('Test case #%d: %s' % (i, tc['desc']))
# When
Expand Down

0 comments on commit f9e4ff0

Please sign in to comment.