From 9fd65c317f6b6f99ac7934413394770798466eef Mon Sep 17 00:00:00 2001 From: Israel Lappe <79846863+ilappe@users.noreply.github.com> Date: Thu, 14 Sep 2023 11:08:03 +0000 Subject: [PATCH 1/4] better fix for inline images --- CHANGELOG.md | 3 +++ parse_emails/handle_eml.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a635dd8..00d318d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Changelog +v0.1.18 +* Fixed an issue where inline image did not parse. + v0.1.17 * Fixed an issue where several unicode spaces weren't parsed as expected. diff --git a/parse_emails/handle_eml.py b/parse_emails/handle_eml.py index 4695d46..8a52530 100644 --- a/parse_emails/handle_eml.py +++ b/parse_emails/handle_eml.py @@ -101,7 +101,7 @@ def handle_eml(file_path, b64=False, file_name=None, parse_only_headers=False, m elif part.get_filename()\ or "attachment" in part.get("Content-Disposition", "")\ - or part.get("X-Attachment-Id"): + or ("image" in part.get("Content-Type") and part.get("Content-Transfer-Encoding") == "base64"): attachment_content_id = part.get('Content-ID') attachment_content_disposition = part.get('Content-Disposition') From a1f6334d4a9dbfa36b8b7b8e63d6232ae69d51bc Mon Sep 17 00:00:00 2001 From: Israel Lappe <79846863+ilappe@users.noreply.github.com> Date: Thu, 14 Sep 2023 11:21:41 +0000 Subject: [PATCH 2/4] fix tests --- parse_emails/handle_eml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parse_emails/handle_eml.py b/parse_emails/handle_eml.py index 8a52530..a0a0c17 100644 --- a/parse_emails/handle_eml.py +++ b/parse_emails/handle_eml.py @@ -101,7 +101,7 @@ def handle_eml(file_path, b64=False, file_name=None, parse_only_headers=False, m elif part.get_filename()\ or "attachment" in part.get("Content-Disposition", "")\ - or ("image" in part.get("Content-Type") and part.get("Content-Transfer-Encoding") == "base64"): + or ("image" in part.get("Content-Type", '') and part.get("Content-Transfer-Encoding") == "base64"): attachment_content_id = part.get('Content-ID') attachment_content_disposition = part.get('Content-Disposition') From 48be49c8783aa8099b223bde0c865199688e341a Mon Sep 17 00:00:00 2001 From: Israel Lappe <79846863+ilappe@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:13:36 +0300 Subject: [PATCH 3/4] Update handle_eml.py - CR changes --- parse_emails/handle_eml.py | 1 + 1 file changed, 1 insertion(+) diff --git a/parse_emails/handle_eml.py b/parse_emails/handle_eml.py index a0a0c17..dfc704e 100644 --- a/parse_emails/handle_eml.py +++ b/parse_emails/handle_eml.py @@ -101,6 +101,7 @@ def handle_eml(file_path, b64=False, file_name=None, parse_only_headers=False, m elif part.get_filename()\ or "attachment" in part.get("Content-Disposition", "")\ + or part.get("X-Attachment-Id")\ or ("image" in part.get("Content-Type", '') and part.get("Content-Transfer-Encoding") == "base64"): attachment_content_id = part.get('Content-ID') From 60c0fe6e8353f1e74ad521f0894b5e5cef31c69b Mon Sep 17 00:00:00 2001 From: Moshe Galitzky <112559840+moishce@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:33:37 +0300 Subject: [PATCH 4/4] Update version in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bd957ab..d800fe0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "parse-emails" -version = "0.1.17" +version = "0.1.18" description = "Parses an email message file and extracts the data from it." authors = ["Demisto"] license = "MIT"