diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fdaf9d6..9fcb3604 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +**v0.24.3** +* Added new close function to the `Message` class to ensure that all embedded `Message` instances get closed as well. Not having this was causing issues with trying to modify the msg file after the user thought that it had been closed. + **v0.24.2** * Fixed bug that somehow escaped detection that caused certain properties to not work. * Fixed bug with embedded msg files introduced in v0.24.0 diff --git a/extract_msg/__init__.py b/extract_msg/__init__.py index 6fedffa9..ab54cbfb 100644 --- a/extract_msg/__init__.py +++ b/extract_msg/__init__.py @@ -27,8 +27,8 @@ # along with this program. If not, see . __author__ = 'Matthew Walker & The Elemental of Creation' -__date__ = '2020-05-29' -__version__ = '0.24.2' +__date__ = '2020-06-18' +__version__ = '0.24.3' from extract_msg import constants from extract_msg.attachment import Attachment diff --git a/extract_msg/message.py b/extract_msg/message.py index 8992bb26..c9a25b75 100644 --- a/extract_msg/message.py +++ b/extract_msg/message.py @@ -164,6 +164,12 @@ def _getStringStream(self, filename, prefix = True): else: tmp = self._getStream(filename + '001E', prefix = False) return None if tmp is None else tmp.decode(self.stringEncoding) + + def close(self): + for attachment in self.attachments: + if attachment.type == 'msg': + attachment.data.close() + olefile.OleFileIO.close(self) def debug(self): for dir_ in self.listDir():