Some badly encoded email causes a traceback in the REST API
I happened upon an email with Subject: =?GB2312?B?saa9o7fmtNPEpbVaQ2h1o6zDt7uoz+PX1L/guq7AtKGj?=
which crashes the post_moderation
endpoint, so it can't be removed.
The traceback is:
Traceback (most recent call last):
[...]
File "/path/mailman/src/mailman/rest/post_moderation.py", line 158, in _resource_as_dict
resource = self._make_resource(request.id)
File "/path/mailman/src/mailman/rest/post_moderation.py", line 101, in _make_resource
make_header(decode_header(resource['subject'])))
File "/usr/lib64/python3.4/email/header.py", line 174, in make_header
h.append(s, charset)
File "/usr/lib64/python3.4/email/header.py", line 298, in append
s = s.decode(input_charset, errors)
UnicodeDecodeError: 'gb2312' codec can't decode byte 0xb5 in position 10: illegal multibyte sequence
I'll send a merge request with a simple fix to protect against this error.