diff options
author | Guido Günther <agx@sigxcpu.org> | 2017-08-28 11:20:14 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2017-08-28 11:30:05 +0200 |
commit | 04ae7d5654684d8077a4125c90e36f4195057fa9 (patch) | |
tree | 83538a1c3d496ac90234cef9a323d5db1688812c /gbp/scripts/common | |
parent | 67cdeac2490839fb9071c634d9ac5c0af0653750 (diff) |
git: Don't decode diff output
The output can be in any encoding so assuming utf-8 is plain wrong
Diffstat (limited to 'gbp/scripts/common')
-rw-r--r-- | gbp/scripts/common/pq.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py index ed56c6da..2f387761 100644 --- a/gbp/scripts/common/pq.py +++ b/gbp/scripts/common/pq.py @@ -170,13 +170,13 @@ def write_patch_file(filename, commit_info, diff): body = commit_info['body'].rstrip() + '\n' try: msg.set_payload(body.encode('us-ascii')) - except UnicodeEncodeError: + except (UnicodeEncodeError): msg.set_payload(body, charset) patch.write(msg.as_string(unixfrom=False, maxheaderlen=77).encode('utf-8')) # Write diff patch.write(b'---\n') - patch.write(diff.encode()) + patch.write(diff) except IOError as err: raise GbpError('Unable to create patch file: %s' % err) return filename |