[Reportbug-maint] Bug#849586: reportbug incorrectly short-circuits From address escaping with non-ASCII characters
Frédéric Brière
fbriere at fbriere.net
Tue Jan 3 18:02:14 UTC 2017
On Wed, Dec 28, 2016 at 02:53:17PM -0800, Russ Allbery wrote:
> According to a thread on debian-devel, reportbug generated a From header
> looking like:
>
> From: =?utf-8?b?VG9tYXMgTWFydGnFoWl1cyA8dG9tYXNAcHVnYS52ZHUubHQ+?=
I was also bitten by this bug this morning. Thank you for the bug
report; this spared me quite a bit of head-scratching.
> addr = email.utils.formataddr((realname, email))
>
> I suspect just removing the re.match conditional and unconditionally
> calling email.utils.formataddr will produce the correct behavior.
You might run into a conflict over the "email" name, though:
addr = email.utils.formataddr((realname, email))
AttributeError: 'str' object has no attribute 'utils'
Other than that, your fix seems to do the trick for me:
>>> import reportbug.utils
>>> reportbug.utils.get_user_id()
'=?utf-8?b?RnLDqWTDqXJpYyBCcmnDqHJl?= <fbriere at fbriere.net>'
Thanks!
More information about the Reportbug-maint
mailing list