Skip to content

Commit d2e321e

Browse files
Correct docstrings and changelog
1 parent 4c23597 commit d2e321e

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
**v0.52.0**
22
* [[TeamMsgExtractor #444](https://github.com/TeamMsgExtractor/msg-extractor/issues/444)] Fix typo in string that prevented HTML body from generating from the plain text body properly.
33
* Adjusted the behavior of `MSGFile.areStringsUnicode` to prioritize the property specified by the parent MSG files for MSG files that are embedded. Additionally, added a fallback to rely on whether or not there is a stream using the `001F` type to determine the property value if it is entirely missing.
4-
* Adjusted `OleWriter.fromMsg()` and `MSGFile.export()` to add the argument `allowBadEmbed` which helps to correct a few different issues that may appear in embedded MSG files. These corrections allow the extracte file to still be extracted and to open properly in Outlook.
5-
* In addition to the above, the errors that some of those corrections will surpress are now significantly more informative about what went wrong.
4+
* Adjusted `OleWriter.fromMsg()` and `MSGFile.export()` to add the argument `allowBadEmbed` which helps to correct a few different issues that may appear in embedded MSG files. These corrections allow the embedded file to still be extracted and to open properly in Outlook.
5+
* In addition to the above, the errors that some of those corrections will suppress are now significantly more informative about what went wrong.
66

77
**v0.51.1**
88
* Add class type added in last version to known class types.

extract_msg/msg_classes/msg.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,8 @@ def export(self, path, allowBadEmbed: bool = False) -> None:
492492
493493
:param path: A path-like object (including strings and ``pathlib.Path``
494494
objects) or an IO device with a write method which accepts bytes.
495+
:param allowBadEmbed: If True, attempts to skip steps that will fail if
496+
the embedded MSG file violates standards. It will also attempt to repair the data to try to ensure it can open in Outlook.
495497
"""
496498
from ..ole_writer import OleWriter
497499

@@ -504,9 +506,12 @@ def export(self, path, allowBadEmbed: bool = False) -> None:
504506
def exportBytes(self, allowBadEmbed: bool = False) -> bytes:
505507
"""
506508
Saves a new copy of the MSG file, returning the bytes.
509+
510+
:param allowBadEmbed: If True, attempts to skip steps that will fail if
511+
the embedded MSG file violates standards. It will also attempt to repair the data to try to ensure it can open in Outlook.
507512
"""
508513
out = io.BytesIO()
509-
self.export(out)
514+
self.export(out, allowBadEmbed)
510515
return out.getvalue()
511516

512517
def fixPath(self, inp: MSG_PATH, prefix: bool = True) -> str:

extract_msg/ole_writer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,11 @@ def fromMsg(self, msg: MSGFile, allowBadEmbed: bool = False) -> None:
808808
"""
809809
Copies the streams and stream information necessary from the MSG file.
810810
811-
:param allowBadEmbed: If true, attempts to skip steps that will fail if
812-
the embedded msg file violates standards. It will also attempt to repair the data to try to ensure it can open in Outlook.
811+
:param allowBadEmbed: If True, attempts to skip steps that will fail if
812+
the embedded MSG file violates standards. It will also attempt to repair the data to try to ensure it can open in Outlook.
813+
814+
:raises StandardViolationError: Something about the embedded data has a
815+
fundemental issue that violates the standard.
813816
"""
814817
# Get the root OLE entry's CLSID.
815818
self.__rootEntry.clsid = _unClsid(msg._getOleEntry('/').clsid)

0 commit comments

Comments
 (0)