launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #22818
[Merge] lp:~cjwatson/launchpad/code-review-mail-encoding into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/code-review-mail-encoding into lp:launchpad.
Commit message:
Fix crash when emailing inline comments on a diff with non-ASCII characters in hunk headers.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1787587 in Launchpad itself: "UnicodeDecodeError when mailing git review comment"
https://bugs.launchpad.net/launchpad/+bug/1787587
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/code-review-mail-encoding/+merge/353326
Similar to https://code.launchpad.net/~wgrant/launchpad/unicode-diff-comments/+merge/219622, but in a slightly different place.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/code-review-mail-encoding into lp:launchpad.
=== modified file 'lib/lp/code/mail/codereviewcomment.py'
--- lib/lp/code/mail/codereviewcomment.py 2015-08-23 22:53:55 +0000
+++ lib/lp/code/mail/codereviewcomment.py 2018-08-17 12:58:38 +0000
@@ -236,7 +236,8 @@
# add context line (hunk header)
line_count += 1 # inc hunk context line
- hunk_lines.append(u'> %s' % hunk.get_header().rstrip('\n'))
+ hunk_lines.append(u'> %s' % hunk.get_header().rstrip('\n').decode(
+ 'utf-8', 'replace'))
# comment for context line (hunk header)
comment = comments.get(str(line_count))
=== modified file 'lib/lp/code/mail/tests/test_codereviewcomment.py'
--- lib/lp/code/mail/tests/test_codereviewcomment.py 2015-10-27 01:13:12 +0000
+++ lib/lp/code/mail/tests/test_codereviewcomment.py 2018-08-17 12:58:38 +0000
@@ -427,7 +427,7 @@
"=== modified file 'foo/bar/bar.py'\n"
"--- bar.py\t2009-08-26 15:53:34.000000000 -0400\n"
"+++ bar.py\t1969-12-31 19:00:00.000000000 -0500\n"
- "@@ -1,3 +0,0 @@\n"
+ "@@ -1,3 +0,0 @@ msgstr \"\xc3\xa5\"\n"
"-\xc3\xa5\n"
"-b\n"
"-c\n"
@@ -705,7 +705,7 @@
'',
'Foo',
'',
- '> @@ -1,3 +0,0 @@',
+ u'> @@ -1,3 +0,0 @@ msgstr "\xe5"',
'',
'Bar',
''],
Follow ups