This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
The following commit(s) were added to refs/heads/master by this push:
new 370c104 Switch to newer python3 email parser policy, to better handle
rfc6531 messages
370c104 is described below
commit 370c1049c38ef16b41c6f1df99475c95c53b0d93
Author: Daniel Gruno <[email protected]>
AuthorDate: Sat Nov 13 02:10:55 2021 +0100
Switch to newer python3 email parser policy, to better handle rfc6531
messages
This enables raw (unencoded) unicode headers in emails to be properly
parsed, by switching away from the default compat32 email policy.
---
tools/archiver.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tools/archiver.py b/tools/archiver.py
index 93a29a8..f3f5cc2 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -42,6 +42,7 @@ import base64
import collections
import email.header
import email.utils
+import email.policy
import fnmatch
import hashlib
import json
@@ -454,7 +455,6 @@ class Archiver(object): # N.B. Also used by import-mbox.py
def default_empty_string(value):
return str(value) if value else ""
-
msg_metadata = dict([(k, default_empty_string(msg.get(k))) for k in
self.keys])
mid = (
hashlib.sha224(
@@ -535,7 +535,6 @@ class Archiver(object): # N.B. Also used by import-mbox.py
irt = ""
output_json = None
-
if body is not None or attachments:
pmid = mid
id_set = list()
@@ -966,7 +965,7 @@ def main():
try:
raw_message = input_stream.read()
try:
- msg = email.message_from_bytes(raw_message)
+ msg = email.message_from_bytes(raw_message,
policy=email.policy.default)
except Exception as err:
print("STDIN parser exception: %s" % err)
sys.exit(-1)