Skip to content

Commit d64c1b4

Browse files
Fix folded header fields
1 parent e664887 commit d64c1b4

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Minor regoanization within `extract_msg/utils.py`.
66
* Minor changes to docstrings.
77
* Minor README updates.
8+
* Fix issue with folded header fields decoding incorrectly when given to `extract_msg.utils.decodeRfc2047`.
89

910
**v0.43.0**
1011
* [[TeamMsgExtractor #56](https://github.com/TeamMsgExtractor/msg-extractor/issues/56)] [[TeamMsgExtractor #248](https://github.com/TeamMsgExtractor/msg-extractor/issues/248)] Added new function `MessageBase.asEmailMessage` which will convert the `MessageBase` instance, if possible, to an `email.message.EmailMessage` object. If an embedded MSG file on a `MessageBase` object is of a class that does not have this function, it will simply be attached to the instance as bytes.

extract_msg/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ def decodeRfc2047(encoded : str) -> str:
202202
"""
203203
Decodes text encoded using the method specified in RFC 2047.
204204
"""
205+
# Fix an issue with folded header fields.
206+
encoded = encoded.replace('\r\n', '')
207+
205208
# This returns a list of tuples containing the bytes and the encoding they
206209
# are using, so we decode each one and join them together.
207210
#

0 commit comments

Comments
 (0)