You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2020/09/03 15:03:49 UTC
[incubator-ponymail-foal] branch master updated: Bug: get_bytes
does not return the raw message
This is an automated email from the ASF dual-hosted git repository.
sebb 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 7854cd2 Bug: get_bytes does not return the raw message
7854cd2 is described below
commit 7854cd22b0f0a494f90615e151e942c77042919a
Author: Sebb <se...@apache.org>
AuthorDate: Thu Sep 3 16:03:30 2020 +0100
Bug: get_bytes does not return the raw message
This fixes #2
---
tools/import-mbox.py | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index 53d354a..1155f3a 100755
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -208,7 +208,13 @@ class SlurpThread(Thread):
for key in messages.iterkeys():
message = messages.get(key)
- message_raw = messages.get_bytes(key)
+ file = messages.get_file(key, True)
+ # If the parsed data is filtered, also need to filter the raw input
+ # so the source agrees with the summary info
+ if message.__class__.__name__ == "MboxoFactory":
+ file = MboxoReader(file)
+ message_raw = file.read()
+ file.close()
sha3 = hashlib.sha3_256(message_raw).hexdigest()
# If --filter is set, discard any messages not matching by continuing to next email
if (
@@ -295,13 +301,6 @@ class SlurpThread(Thread):
continue
if json:
- file = messages.get_file(key, True)
- # If the parsed data is filtered, also need to filter the raw input
- # so the source agrees with the summary info
- if message.__class__.__name__ == "MboxoFactory":
- file = MboxoReader(file)
- raw_msg = file.read()
- file.close()
if args.dups:
try:
duplicates[json["mid"]].append(
@@ -318,7 +317,7 @@ class SlurpThread(Thread):
"permalink": json["mid"],
"mid": sha3,
"message-id": json["message-id"],
- "source": archiver.mbox_source(raw_msg),
+ "source": archiver.mbox_source(message_raw),
}
except Exception as e:
self.printid(