Message6967
I got this traceback on email with subject encoding Q:
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/roundup/mailgw.py", line 1511, in handle_Message
return self.handle_message(message)
File "/usr/lib/python3.7/site-packages/roundup/mailgw.py", line 1583, in handle_message
return self._handle_message(message)
File "/usr/lib/python3.7/site-packages/roundup/mailgw.py", line 1594, in _handle_message
self.parsed_message = self.parsed_message_class(self, message)
File "/usr/lib/python3.7/site-packages/roundup/mailgw.py", line 509, in __init__
self.subject = message.get_header('subject', '')
File "/usr/lib/python3.7/site-packages/roundup/mailgw.py", line 252, in get_header
return self._decode_header(value.replace('\n', ''))
File "/usr/lib/python3.7/site-packages/roundup/mailgw.py", line 219, in _decode_header
for part, encoding in decode_header(hdr):
File "/usr/lib/python3.7/site-packages/roundup/anypy/email_.py", line 124, in decode_header
last_word += word
TypeError: can only concatenate str (not "bytes") to str
I found that the roundup.anypy.email_.decode_header which is a copy of the stdlib email.header.decode_header is missing a line which convert word into bytes if it is a str (on Python3).
Here is attached a patch which applies the change only for Python3.
Also I think the fix of issue2551008 may be removed as now decode_header will always returns bytes.
It will even better to remove roundup.anypy.email_ completly once Python2 is no more supported (issue2550879). |
|
Date |
User |
Action |
Args |
2020-10-08 14:51:36 | ced | set | recipients:
+ ced |
2020-10-08 14:51:36 | ced | set | messageid: <1602168696.54.0.366137933362.issue2551092@roundup.psfhosted.org> |
2020-10-08 14:51:36 | ced | link | issue2551092 messages |
2020-10-08 14:51:36 | ced | create | |
|