mailman: cope with mails containing broken unicode
See https://pagure.io/fedora-infrastructure/issue/8824 for details. This enables the hotfix on staging only to enable testing. Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
parent
d9cf4bbca7
commit
0543b8addc
2 changed files with 29 additions and 0 deletions
19
files/hotfix/mailman3/mailman3-broken-unicode-emails.patch
Normal file
19
files/hotfix/mailman3/mailman3-broken-unicode-emails.patch
Normal file
|
@ -0,0 +1,19 @@
|
|||
--- a/src/mailman/email/message.py
|
||||
+++ b/src/mailman/email/message.py
|
||||
@@ -47,6 +47,16 @@ class Message(email.message.Message):
|
||||
def __setstate__(self, values):
|
||||
self.__dict__ = values
|
||||
|
||||
+ def as_string(self):
|
||||
+ # Work around for https://bugs.python.org/issue27321 and
|
||||
+ # https://bugs.python.org/issue32330.
|
||||
+ try:
|
||||
+ value = email.message.Message.as_string(self)
|
||||
+ except (KeyError, UnicodeEncodeError):
|
||||
+ value = email.message.Message.as_bytes(self).decode(
|
||||
+ 'ascii', 'replace')
|
||||
+ return value
|
||||
+
|
||||
@property
|
||||
def sender(self):
|
||||
"""The address considered to be the author of the email.
|
Loading…
Add table
Add a link
Reference in a new issue