Skip to content

Commit

Permalink
quoted-printable fix_leading_dot() no longer cuts the line in the mid…
Browse files Browse the repository at this point in the history
…dle of a quoted character
  • Loading branch information
thrawn01 committed Oct 22, 2019
1 parent 12532b3 commit 44ad472
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flanker/mime/message/part.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,8 +730,8 @@ def _quote_and_cut(ln):

# Should be a quoted character
if c == b'=':
# Peak ahead, do the next 2 chars appear to be a hex values?
if quopri.ishex(ln[pos+1:pos+3]):
# Peak ahead, does the next char appear to be a hex value?
if quopri.ishex(ln[pos+1:pos+2]):
in_quote = 1
continue

Expand Down
7 changes: 7 additions & 0 deletions tests/mime/message/headers/part_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@
'=2Equick brown fox, quick brown cat =09=\n' +
' quick read dog, quic=\n' +
'k white bird'),
# Should avoid cutting in the middle of multiple quoted characters near the cut point
(b'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz' +
b'.foo. 🙂 also there is 🙂 more in 🙂 this 🙂 message</body></html>',
'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz=\n' +
'=2Efoo. =F0=9F=99=82 also there is =F0=9F=\n' +
'=99=82 more in =F0=9F=99=82 this =F0=\n'
'=9F=99=82 message</body></html>'),
)


Expand Down

0 comments on commit 44ad472

Please sign in to comment.