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 b8d9346  if inline, convert entire part to rfc822 source attachment
b8d9346 is described below

commit b8d934631aae9e83f18bb1354bb058fde018e5d6
Author: Daniel Gruno <[email protected]>
AuthorDate: Thu Jan 6 18:38:55 2022 +0100

    if inline, convert entire part to rfc822 source attachment
---
 tools/archiver.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/archiver.py b/tools/archiver.py
index 43d44f9..af491b6 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -135,13 +135,15 @@ def parse_attachment(
         cdtype = dispositions[0].lower()
         if cdtype in {"attachment", "inline"}:
             fd = part.get_payload(decode=True)
-            # Allow for empty string
-            if fd is None:
-                return None, None
             filename = part.get_filename()
             # If inline-attached email, fake a name
             if not filename and part.get_content_type() and 
part.get_content_type().lower() == "message/rfc822":
                 filename = "attached_email.eml"
+                if not fd and cdtype == "inline":  # If inline, convert to 
source
+                    fd = part.as_bytes()
+            # Allow for empty string
+            if fd is None:
+                return None, None
             if filename:
                 attachment = {
                     "content_type": part.get_content_type(),

Reply via email to