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 4d644b1 Type checking fixes 4d644b1 is described below commit 4d644b1058fc015236e68a28f3ff43506d93830a Author: Sebb <s...@apache.org> AuthorDate: Sat Apr 27 23:54:05 2024 +0100 Type checking fixes --- server/plugins/messages.py | 1 + tools/archiver.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/server/plugins/messages.py b/server/plugins/messages.py index 584df4d..7443954 100644 --- a/server/plugins/messages.py +++ b/server/plugins/messages.py @@ -558,6 +558,7 @@ class ThreadConstructor: """Turns a flat array of emails into a nested structure of threads""" for cur_email in sorted(self.emails, key=lambda x: x["epoch"]): author = cur_email.get("from") + assert(author) if author not in self.authors: self.authors[author] = [0, cur_email.get("gravatar", "")] self.authors[author][0] += 1 diff --git a/tools/archiver.py b/tools/archiver.py index 2feb887..96e831a 100755 --- a/tools/archiver.py +++ b/tools/archiver.py @@ -158,6 +158,7 @@ def parse_attachment( # Allow for empty string if fd is None: return None, None + assert(isinstance(fd, bytes)) # decode=True generates bytes if filename: attachment = { "content_type": part.get_content_type(), @@ -202,6 +203,7 @@ class Body: self.bytes = part.get_payload(decode=True) self.html_as_source = False if self.bytes is not None: + assert(isinstance(self.bytes, bytes)) # decode=True generates bytes valid_encodings = [x for x in self.charsets if x] if valid_encodings: for cs in valid_encodings: