Skip to content

Commit bddc24a

Browse files
authored
Merge pull request #109 from demisto/fixed-obj-issue
Fixed an issue where some EML files were incorrectly decoded.
2 parents 1c1ebec + c69be3b commit bddc24a

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
v0.1.35
4+
* Fixed an issue where some EML files were incorrectly decoded.
5+
36
v0.1.34
47
* Fixed an issue that prevented the headers from being parsed correctly for eml files (unknown-8bit encoding).
58
* Fixed an issue that email with attachment was parsed incorrectly for eml files.

parse_emails/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def convert_to_unicode(s, is_msg_header=True):
4444
return res.strip()
4545
except Exception:
4646
if s and 'unknown-8bit' in s:
47-
s = email.header.make_header(email.header.decode_header(s))
47+
s = str(email.header.make_header(email.header.decode_header(s)))
4848
else:
4949
for file_data in ENCODINGS_TYPES:
5050
try:

parse_emails/tests/parse_emails_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,7 @@ def test_handle_eml_unknown8bit():
991991
email_parser = EmailParser(file_path='parse_emails/tests/test_data/test-unknown-8bit.eml')
992992
results = email_parser.parse()
993993
assert results['From'] == '[email protected]'
994+
assert results['HeadersMap']['From'] == '"test" <[email protected]>'
994995

995996

996997
def test_multipart_eml_with_eml_attachment_containing_html_body():

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "parse-emails"
3-
version = "0.1.34"
3+
version = "0.1.35"
44
description = "Parses an email message file and extracts the data from it."
55
authors = ["Demisto"]
66
license = "MIT"

0 commit comments

Comments
 (0)