Skip to content

Commit

Permalink
Merge pull request #109 from demisto/fixed-obj-issue
Browse files Browse the repository at this point in the history
Fixed an issue where some EML files were incorrectly decoded.
  • Loading branch information
moishce authored Feb 5, 2025
2 parents 1c1ebec + c69be3b commit bddc24a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

v0.1.35
* Fixed an issue where some EML files were incorrectly decoded.

v0.1.34
* Fixed an issue that prevented the headers from being parsed correctly for eml files (unknown-8bit encoding).
* Fixed an issue that email with attachment was parsed incorrectly for eml files.
Expand Down
2 changes: 1 addition & 1 deletion parse_emails/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def convert_to_unicode(s, is_msg_header=True):
return res.strip()
except Exception:
if s and 'unknown-8bit' in s:
s = email.header.make_header(email.header.decode_header(s))
s = str(email.header.make_header(email.header.decode_header(s)))
else:
for file_data in ENCODINGS_TYPES:
try:
Expand Down
1 change: 1 addition & 0 deletions parse_emails/tests/parse_emails_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,7 @@ def test_handle_eml_unknown8bit():
email_parser = EmailParser(file_path='parse_emails/tests/test_data/test-unknown-8bit.eml')
results = email_parser.parse()
assert results['From'] == '[email protected]'
assert results['HeadersMap']['From'] == '"test" <[email protected]>'


def test_multipart_eml_with_eml_attachment_containing_html_body():
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "parse-emails"
version = "0.1.34"
version = "0.1.35"
description = "Parses an email message file and extracts the data from it."
authors = ["Demisto"]
license = "MIT"
Expand Down

0 comments on commit bddc24a

Please sign in to comment.