changeset 36073:95791b275b73

py3: convert content-type to bytes This fixes the exception: TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'str' On the line: ui.debug('Content-Type: %s\n' % content_type) And it prevents additional exceptions that use the content_type variable later. Differential Revision: https://phab.mercurial-scm.org/D2136
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Feb 2018 10:49:00 -0800
parents f3d8f61c425d
children 788b2e8530ae
files mercurial/patch.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Sun Feb 11 18:32:37 2018 -0500
+++ b/mercurial/patch.py	Sun Feb 11 10:49:00 2018 -0800
@@ -242,7 +242,7 @@
         ok_types = ('text/plain', 'text/x-diff', 'text/x-patch')
         message = ''
         for part in msg.walk():
-            content_type = part.get_content_type()
+            content_type = pycompat.bytestr(part.get_content_type())
             ui.debug('Content-Type: %s\n' % content_type)
             if content_type not in ok_types:
                 continue