Skip to content

Commit 04c2deb

Browse files
Merge pull request #433 from TeamMsgExtractor/next-release
v0.50.0
2 parents aeea79b + 978c8d1 commit 04c2deb

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
**v0.50.0**
2+
* [[TeamMsgExtractor #432](https://github.com/TeamMsgExtractor/msg-extractor/issues/432)] Adjust html header code to replace non-ascii characters with escaped versions. Also adujusted plain text to html conversion to ensure non-ascii character from the body are encoded to escpaed values to be safe.
3+
* Made some corrections to `NullDate`.
4+
15
**v0.49.0**
26
* [[TeamMsgExtractor #427](https://github.com/TeamMsgExtractor/msg-extractor/issues/427)] Adjusted code for converting time stamps to create null dates for any time stamp beyond a certain point. The point was determined to be close to the existing null dates.
37
* [[TeamMsgExtractor #425](https://github.com/TeamMsgExtractor/msg-extractor/issues/425)] Added basic support for custom attachments that are Windows Metafiles.

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ your access to the newest major version of extract-msg.
260260
.. |License: GPL v3| image:: https://img.shields.io/badge/License-GPLv3-blue.svg
261261
:target: LICENSE.txt
262262

263-
.. |PyPI3| image:: https://img.shields.io/badge/pypi-0.49.0-blue.svg
264-
:target: https://pypi.org/project/extract-msg/0.49.0/
263+
.. |PyPI3| image:: https://img.shields.io/badge/pypi-0.50.0-blue.svg
264+
:target: https://pypi.org/project/extract-msg/0.50.0/
265265

266266
.. |PyPI2| image:: https://img.shields.io/badge/python-3.8+-brightgreen.svg
267267
:target: https://www.python.org/downloads/release/python-3810/

extract_msg/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2828

2929
__author__ = 'Destiny Peterson & Matthew Walker'
30-
__date__ = '2024-08-21'
31-
__version__ = '0.49.0'
30+
__date__ = '2024-10-07'
31+
__version__ = '0.50.0'
3232

3333
__all__ = [
3434
# Modules:

extract_msg/msg_classes/message_base.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1163,14 +1163,14 @@ def htmlBody(self) -> Optional[bytes]:
11631163
pass
11641164
elif self.rtfBody:
11651165
logger.info('HTML body was not found, attempting to generate from RTF.')
1166-
htmlBody = self.deencapsulateBody(self.rtfBody, DeencapType.HTML)
1166+
htmlBody = cast(bytes, self.deencapsulateBody(self.rtfBody, DeencapType.HTML))
11671167
# This is it's own if statement so we can ensure it will generate
11681168
# even if there is an rtfBody, in the event it doesn't have HTML.
11691169
if not htmlBody and self.body:
11701170
# Convert the plain text body to html.
11711171
logger.info('HTML body was not found, attempting to generate from plain text body.')
11721172
correctedBody = html.escape(self.body).replace('\r', '').replace('\n', '<br />')
1173-
htmlBody = f'<html><body>{correctedBody}</body></head>'.encode('utf-8')
1173+
htmlBody = f'<html><body>{correctedBody}</body></head>'.encode('ascii', 'xmlreplace')
11741174

11751175
if not htmlBody:
11761176
logger.info('HTML body could not be found nor generated.')
@@ -1213,7 +1213,7 @@ def htmlInjectableHeader(self) -> str:
12131213
prefix = '<div id="injectedHeader"><div><p class="MsoNormal">'
12141214
suffix = '<o:p></o:p></p></div></div>'
12151215
joinStr = '<br/>'
1216-
formatter = (lambda name, value: f'<b>{name}:</b>&nbsp;{inputToString(htmlSanitize(value), self.stringEncoding)}')
1216+
formatter = (lambda name, value: f'<b>{name}:</b>&nbsp;{inputToString(htmlSanitize(value), self.stringEncoding).encode('ascii', 'xmlcharrefreplace').decode()}')
12171217

12181218
return self.getInjectableHeader(prefix, joinStr, suffix, formatter)
12191219

extract_msg/null_date.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class NullDate(datetime.datetime):
2626
def __eq__(self, other) -> bool:
2727
if isinstance(other, NullDate):
2828
return True
29-
return super.__eq__(self, other)
29+
return super().__eq__(other)
3030

3131
def __ne__(self, other) -> bool:
3232
if isinstance(other, NullDate):
3333
return False
34-
return super.__eq__(self, other)
34+
return super().__eq__(other)

0 commit comments

Comments
 (0)