patchbomb: use native strs for email header keys and values
authorAugie Fackler <augie@google.com>
Thu, 09 Aug 2018 18:28:43 -0400
changeset 39033 ed9537bd2d1a
parent 39032 8979626089bb
child 39034 751caa6a2936
patchbomb: use native strs for email header keys and values Differential Revision: https://phab.mercurial-scm.org/D4223
hgext/patchbomb.py
--- a/hgext/patchbomb.py	Thu Aug 09 18:28:19 2018 -0400
+++ b/hgext/patchbomb.py	Thu Aug 09 18:28:43 2018 -0400
@@ -378,8 +378,8 @@
     datapart = emimebase.MIMEBase('application', 'x-mercurial-bundle')
     datapart.set_payload(bundle)
     bundlename = '%s.hg' % opts.get(r'bundlename', 'bundle')
-    datapart.add_header('Content-Disposition', 'attachment',
-                        filename=bundlename)
+    datapart.add_header(r'Content-Disposition', r'attachment',
+                        filename=encoding.strfromlocal(bundlename))
     emailencoders.encode_base64(datapart)
     msg.attach(datapart)
     msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get(r'test'))