extract-msg 0.57.0__tar.gz → 0.58.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. {extract_msg-0.57.0 → extract_msg-0.58.0}/CHANGELOG.md +13 -0
  2. {extract_msg-0.57.0 → extract_msg-0.58.0}/PKG-INFO +4 -4
  3. {extract_msg-0.57.0 → extract_msg-0.58.0}/README.rst +3 -3
  4. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/__init__.py +8 -2
  5. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/attachment_base.py +20 -20
  6. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/custom_att_handler/custom_handler.py +2 -3
  7. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/constants/__init__.py +219 -1
  8. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/msg.py +43 -59
  9. extract_msg-0.58.0/extract_msg/msg_path.py +85 -0
  10. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/ole_writer.py +17 -16
  11. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/properties/named.py +5 -4
  12. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/recipient.py +16 -15
  13. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/utils.py +6 -42
  14. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg.egg-info/PKG-INFO +4 -4
  15. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg.egg-info/SOURCES.txt +14 -1
  16. extract_msg-0.58.0/extract_msg.egg-info/top_level.txt +2 -0
  17. extract_msg-0.58.0/extract_msg_tests/__init__.py +24 -0
  18. extract_msg-0.58.0/extract_msg_tests/attachment_tests.py +91 -0
  19. extract_msg-0.58.0/extract_msg_tests/cmd_line_tests.py +164 -0
  20. extract_msg-0.58.0/extract_msg_tests/constants.py +26 -0
  21. extract_msg-0.58.0/extract_msg_tests/message_tests.py +118 -0
  22. extract_msg-0.58.0/extract_msg_tests/msg_base_tests.py +159 -0
  23. extract_msg-0.58.0/extract_msg_tests/ole_writer_tests.py +164 -0
  24. extract_msg-0.58.0/extract_msg_tests/prop_tests.py +455 -0
  25. extract_msg-0.58.0/extract_msg_tests/signed_tests.py +35 -0
  26. extract_msg-0.58.0/extract_msg_tests/util_tests.py +137 -0
  27. extract_msg-0.58.0/extract_msg_tests/validation_tests.py +86 -0
  28. extract_msg-0.58.0/extract_msg_tests/wk_tests.py +164 -0
  29. {extract_msg-0.57.0 → extract_msg-0.58.0}/setup.py +2 -2
  30. extract_msg-0.57.0/extract_msg.egg-info/top_level.txt +0 -1
  31. {extract_msg-0.57.0 → extract_msg-0.58.0}/LICENSE.txt +0 -0
  32. {extract_msg-0.57.0 → extract_msg-0.58.0}/MANIFEST.in +0 -0
  33. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/__main__.py +0 -0
  34. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/_rtf/__init__.py +0 -0
  35. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/_rtf/create_doc.py +0 -0
  36. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/_rtf/inject_rtf.py +0 -0
  37. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/_rtf/token.py +0 -0
  38. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/_rtf/tokenize_rtf.py +0 -0
  39. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/__init__.py +0 -0
  40. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/attachment.py +0 -0
  41. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/broken_att.py +0 -0
  42. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/custom_att.py +0 -0
  43. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/custom_att_handler/__init__.py +0 -0
  44. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/custom_att_handler/lnk_obj_att.py +0 -0
  45. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/custom_att_handler/outlook_image_dib.py +0 -0
  46. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/custom_att_handler/outlook_image_meta.py +0 -0
  47. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/emb_msg_att.py +0 -0
  48. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/signed_att.py +0 -0
  49. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/unsupported_att.py +0 -0
  50. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/attachments/web_att.py +0 -0
  51. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/constants/ps.py +0 -0
  52. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/constants/re.py +0 -0
  53. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/constants/st.py +0 -0
  54. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/data/logging-config/logging-nt.json +0 -0
  55. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/data/logging-config/logging-posix.json +0 -0
  56. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/encoding/__init__.py +0 -0
  57. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/encoding/_dt/__init__.py +0 -0
  58. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/encoding/_dt/_mac_ce.py +0 -0
  59. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/encoding/_dt/_mac_cyrillic.py +0 -0
  60. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/encoding/_dt/_mac_greek.py +0 -0
  61. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/encoding/_dt/_mac_iceland.py +0 -0
  62. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/encoding/_dt/_mac_turkish.py +0 -0
  63. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/encoding/_dt/_win874_dec.py +0 -0
  64. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/encoding/_dt/_win950_dec.py +0 -0
  65. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/encoding/utils.py +0 -0
  66. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/enums.py +0 -0
  67. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/exceptions.py +0 -0
  68. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/__init__.py +0 -0
  69. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/appointment.py +0 -0
  70. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/calendar.py +0 -0
  71. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/calendar_base.py +0 -0
  72. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/contact.py +0 -0
  73. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/journal.py +0 -0
  74. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/meeting_cancellation.py +0 -0
  75. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/meeting_exception.py +0 -0
  76. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/meeting_forward.py +0 -0
  77. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/meeting_related.py +0 -0
  78. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/meeting_request.py +0 -0
  79. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/meeting_response.py +0 -0
  80. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/message.py +0 -0
  81. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/message_base.py +0 -0
  82. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/message_signed.py +0 -0
  83. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/message_signed_base.py +0 -0
  84. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/post.py +0 -0
  85. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/sticky_note.py +0 -0
  86. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/task.py +0 -0
  87. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/msg_classes/task_request.py +0 -0
  88. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/null_date.py +0 -0
  89. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/open_msg.py +0 -0
  90. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/properties/__init__.py +0 -0
  91. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/properties/prop.py +0 -0
  92. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/properties/properties_store.py +0 -0
  93. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/py.typed +0 -0
  94. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/__init__.py +0 -0
  95. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/_helpers.py +0 -0
  96. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/business_card.py +0 -0
  97. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/cfoas.py +0 -0
  98. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/contact_link_entry.py +0 -0
  99. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/dev_mode_a.py +0 -0
  100. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/dv_target_device.py +0 -0
  101. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/entry_id.py +0 -0
  102. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/misc_id.py +0 -0
  103. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/mon_stream.py +0 -0
  104. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/odt.py +0 -0
  105. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/ole_pres.py +0 -0
  106. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/ole_stream_struct.py +0 -0
  107. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/recurrence_pattern.py +0 -0
  108. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/report_tag.py +0 -0
  109. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/system_time.py +0 -0
  110. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/time_zone_definition.py +0 -0
  111. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/time_zone_struct.py +0 -0
  112. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/toc_entry.py +0 -0
  113. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg/structures/tz_rule.py +0 -0
  114. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg.egg-info/dependency_links.txt +0 -0
  115. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg.egg-info/entry_points.txt +0 -0
  116. {extract_msg-0.57.0 → extract_msg-0.58.0}/extract_msg.egg-info/requires.txt +0 -0
  117. {extract_msg-0.57.0 → extract_msg-0.58.0}/requirements.txt +0 -0
  118. {extract_msg-0.57.0 → extract_msg-0.58.0}/setup.cfg +0 -0
@@ -1,3 +1,16 @@
1
+ **v0.58.0**
2
+ * Changed module to primarily use `MSGPath` for pathing. All functions still except string paths or list paths, they now just also accept `MSGPath` and use it under the hood for path conversions. With this, some functions have been changed to specifically return `MSGPath` rather than list and string versions of paths. Removed: `MSGBase.prefixList`, `utils.inputToMsgPath()`, and `utils.msgPathToString()`. Modified: `*.fixPath()`, `*.listDir()`, and `MSGBase.prefix`.
3
+ * Changed setup to use `find_packages()` to try and get ahead of deprecation and ensure all files are distributed correctly.
4
+ * Fixed `MSGFile.existsTypedProperty()` to actually do what it says it will do. Previous code had it not checking if the right directory was being searched when `location` was specified.
5
+ * Changed `MSGFile.sExists()` to correctly detect *only* the valid string stream type for the MSG file instead of unconditionally checking both types.
6
+ * Re-added `extract_msg.constants.PROPERTIES` which was removed for unknown reasons in an earlier version (0.42.0). `MSGBase.saveRaw()` appears to have been non-functional since then.
7
+
8
+ **v0.57.1**
9
+ * [[TeamMsgExtractor #489](https://github.com/TeamMsgExtractor/msg-extractor/issues/489)] Fix an issue where `MessageSignedBase.body` would raise an error when the plain text body was not utf-8 encoded bytes. This error was due to `extract_msg.utils.unwrapMultipart()` accidentally returning the plain text body as bytes instead of string.
10
+ * Change some of the command line documentation.
11
+ * Fix some of the imports in `extract_msg/__init__.py`.
12
+ * Add additional tests to module.
13
+
1
14
  **v0.57.0**
2
15
  * [[Advisory GHSA-cxpg-prmv-g4pp](https://github.com/TeamMsgExtractor/msg-extractor/security/advisories/GHSA-cxpg-prmv-g4pp)] Fixed a vulnerability related to unchecked input passed out to wkhtmltopdf when converting the MSG file to PDF. Javascript is now strongly blocked from being enabled and will be stripped from the HTML where appropriate before reaching wkhtmltopdf. Additionally, the option `--wk-allow-external-files` on the command line (or `wkAllowExternalFiles` to `MessageBase.save()`) will be required for external files to be loaded into the HTML to convert. Without these, they will be stripped before reaching wkhtmltopdf for security.
3
16
  * [[Advisory GHSA-mqxr-j8rh-p4q4](https://github.com/TeamMsgExtractor/msg-extractor/security/advisories/GHSA-mqxr-j8rh-p4q4)] Fixed an issue where an attacker controlled MSG file could take advantage of a poorly written section of code in the RTF deencapsulation function on the `extract-msg` side to waste massive amounts of time and memory resources.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: extract_msg
3
- Version: 0.57.0
3
+ Version: 0.58.0
4
4
  Summary: Extracts emails and attachments saved in Microsoft Outlook's .msg files
5
5
  Home-page: https://github.com/TeamMsgExtractor/msg-extractor
6
6
  Download-URL: https://github.com/TeamMsgExtractor/msg-extractor/archives/master
@@ -105,7 +105,7 @@ refer to the usage information provided from the program's help dialog:
105
105
  --pdf Saves the body as a PDF. If this is not possible, will error.
106
106
  --wk-path WKPATH Overrides the path for finding wkhtmltopdf.
107
107
  --wk-options [WKOPTIONS ...]
108
- Sets additional options to be used in wkhtmltopdf. Should be a series of options and values, replacing the - or -- in the beginning with + or ++ respectively. For example: --wk-options "+O Landscape"
108
+ Sets additional options to be used in wkhtmltopdf. Should be a series of options and values, replacing the - or -- in the beginning with + or ++ respectively. For example: --wk-options "+O Landscape" "++no-images"
109
109
  --wk-allow-external-files
110
110
  Enables external files to appear in the PDF output. WARNING: This allows wkpdftohtml to make url requests that are unchecked, and as such may be a security vulnerability in untrusted emails. Only use this option if you trust the source of the MSG file.
111
111
  --prepared-html When used in conjunction with --html, sets whether the HTML output should be prepared for embedded attachments.
@@ -287,8 +287,8 @@ your access to the newest major version of extract-msg.
287
287
  .. |License: GPL v3| image:: https://img.shields.io/badge/License-GPLv3-blue.svg
288
288
  :target: LICENSE.txt
289
289
 
290
- .. |PyPI3| image:: https://img.shields.io/badge/pypi-0.57.0-blue.svg
291
- :target: https://pypi.org/project/extract-msg/0.57.0/
290
+ .. |PyPI3| image:: https://img.shields.io/badge/pypi-0.58.0-blue.svg
291
+ :target: https://pypi.org/project/extract-msg/0.58.0/
292
292
 
293
293
  .. |PyPI2| image:: https://img.shields.io/badge/python-3.8+-brightgreen.svg
294
294
  :target: https://www.python.org/downloads/release/python-3810/
@@ -86,7 +86,7 @@ refer to the usage information provided from the program's help dialog:
86
86
  --pdf Saves the body as a PDF. If this is not possible, will error.
87
87
  --wk-path WKPATH Overrides the path for finding wkhtmltopdf.
88
88
  --wk-options [WKOPTIONS ...]
89
- Sets additional options to be used in wkhtmltopdf. Should be a series of options and values, replacing the - or -- in the beginning with + or ++ respectively. For example: --wk-options "+O Landscape"
89
+ Sets additional options to be used in wkhtmltopdf. Should be a series of options and values, replacing the - or -- in the beginning with + or ++ respectively. For example: --wk-options "+O Landscape" "++no-images"
90
90
  --wk-allow-external-files
91
91
  Enables external files to appear in the PDF output. WARNING: This allows wkpdftohtml to make url requests that are unchecked, and as such may be a security vulnerability in untrusted emails. Only use this option if you trust the source of the MSG file.
92
92
  --prepared-html When used in conjunction with --html, sets whether the HTML output should be prepared for embedded attachments.
@@ -268,8 +268,8 @@ your access to the newest major version of extract-msg.
268
268
  .. |License: GPL v3| image:: https://img.shields.io/badge/License-GPLv3-blue.svg
269
269
  :target: LICENSE.txt
270
270
 
271
- .. |PyPI3| image:: https://img.shields.io/badge/pypi-0.57.0-blue.svg
272
- :target: https://pypi.org/project/extract-msg/0.57.0/
271
+ .. |PyPI3| image:: https://img.shields.io/badge/pypi-0.58.0-blue.svg
272
+ :target: https://pypi.org/project/extract-msg/0.58.0/
273
273
 
274
274
  .. |PyPI2| image:: https://img.shields.io/badge/python-3.8+-brightgreen.svg
275
275
  :target: https://www.python.org/downloads/release/python-3810/
@@ -27,8 +27,8 @@ https://github.com/TeamMsgExtractor/msg-extractor
27
27
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
28
28
 
29
29
  __author__ = 'Destiny Peterson & Matthew Walker'
30
- __date__ = '2026-10-24'
31
- __version__ = '0.57.0'
30
+ __date__ = '2026-10-28'
31
+ __version__ = '0.58.0'
32
32
 
33
33
  __all__ = [
34
34
  # Modules:
@@ -37,15 +37,19 @@ __all__ = [
37
37
  'enums',
38
38
  'exceptions',
39
39
  'msg_classes',
40
+ 'msg_path',
41
+ 'open_msg',
40
42
  'null_date',
41
43
  'properties',
42
44
  'structures',
45
+ 'utils',
43
46
 
44
47
  # Classes:
45
48
  'Attachment',
46
49
  'AttachmentBase',
47
50
  'Message',
48
51
  'MSGFile',
52
+ 'MSGPath',
49
53
  'Named',
50
54
  'NamedProperties',
51
55
  'OleWriter',
@@ -61,10 +65,12 @@ __all__ = [
61
65
 
62
66
  # Ensure these are imported before anything else.
63
67
  from . import constants, enums, exceptions
68
+ from . import utils
64
69
 
65
70
  from . import attachments, msg_classes, null_date, properties, structures
66
71
  from .attachments import Attachment, AttachmentBase, SignedAttachment
67
72
  from .msg_classes import Message, MSGFile
73
+ from .msg_path import MSGPath
68
74
  from .ole_writer import OleWriter
69
75
  from .open_msg import openMsg, openMsgBulk
70
76
  from .properties import Named, NamedProperties, PropertiesStore
@@ -21,11 +21,10 @@ from typing import (
21
21
 
22
22
  from ..constants import MSG_PATH, OVERRIDE_CLASS, SAVE_TYPE
23
23
  from ..enums import AttachmentType
24
+ from ..msg_path import MSGPath
24
25
  from ..properties.named import NamedProperties
25
26
  from ..properties.properties_store import PropertiesStore
26
- from ..utils import (
27
- msgPathToString, tryGetMimetype, verifyPropertyId, verifyType
28
- )
27
+ from ..utils import tryGetMimetype, verifyPropertyId, verifyType
29
28
 
30
29
 
31
30
  # Allow for nice type checking.
@@ -51,7 +50,7 @@ class AttachmentBase(abc.ABC):
51
50
  :param propStore: The PropertiesStore instance for the attachment.
52
51
  """
53
52
  self.__msg = weakref.ref(msg)
54
- self.__dir = dir_
53
+ self.__dir = MSGPath(dir_)
55
54
  self.__props = propStore
56
55
  self.__namedProperties = NamedProperties(msg.named, self)
57
56
  self.__treePath = msg.treePath + [weakref.ref(self)]
@@ -150,7 +149,7 @@ class AttachmentBase(abc.ABC):
150
149
  """
151
150
  if (msg := self.__msg()) is None:
152
151
  raise ReferenceError('The MSGFile for this Attachment instance has been garbage collected.')
153
- return msg._getTypedStream([self.__dir, msgPathToString(filename)], True, _type)
152
+ return msg._getTypedStream(MSGPath(self.__dir, filename), True, _type)
154
153
 
155
154
  def _handleFnc(self, _zip, filename, customPath: pathlib.Path, kwargs) -> pathlib.Path:
156
155
  """
@@ -203,7 +202,7 @@ class AttachmentBase(abc.ABC):
203
202
  """
204
203
  if (msg := self.__msg()) is None:
205
204
  raise ReferenceError('The MSGFile for this Attachment instance has been garbage collected.')
206
- return msg.exists([self.__dir, msgPathToString(filename)])
205
+ return msg.exists(MSGPath(self.__dir, filename))
207
206
 
208
207
  def sExists(self, filename: MSG_PATH) -> bool:
209
208
  """
@@ -214,7 +213,7 @@ class AttachmentBase(abc.ABC):
214
213
  """
215
214
  if (msg := self.__msg()) is None:
216
215
  raise ReferenceError('The MSGFile for this Attachment instance has been garbage collected.')
217
- return msg.sExists([self.__dir, msgPathToString(filename)])
216
+ return msg.sExists(MSGPath(self.__dir, filename))
218
217
 
219
218
  def existsTypedProperty(self, id, _type = None) -> Tuple[bool, int]:
220
219
  """
@@ -255,7 +254,7 @@ class AttachmentBase(abc.ABC):
255
254
  """
256
255
  if (msg := self.__msg()) is None:
257
256
  raise ReferenceError('The MSGFile for this Attachment instance has been garbage collected.')
258
- return msg.getMultipleBinary([self.__dir, msgPathToString(filename)])
257
+ return msg.getMultipleBinary(MSGPath(self.__dir, filename))
259
258
 
260
259
  def getMultipleString(self, filename: MSG_PATH) -> Optional[List[str]]:
261
260
  """
@@ -270,7 +269,7 @@ class AttachmentBase(abc.ABC):
270
269
  """
271
270
  if (msg := self.__msg()) is None:
272
271
  raise ReferenceError('The MSGFile for this Attachment instance has been garbage collected.')
273
- return msg.getMultipleString([self.__dir, msgPathToString(filename)])
272
+ return msg.getMultipleString(MSGPath(self.__dir, filename))
274
273
 
275
274
  def getNamedAs(self, propertyName: str, guid: str, overrideClass: OVERRIDE_CLASS[_T]) -> Optional[_T]:
276
275
  """
@@ -338,7 +337,7 @@ class AttachmentBase(abc.ABC):
338
337
  """
339
338
  if (msg := self.__msg()) is None:
340
339
  raise ReferenceError('The MSGFile for this Attachment instance has been garbage collected.')
341
- return msg.getSingleOrMultipleBinary([self.__dir, msgPathToString(filename)])
340
+ return msg.getSingleOrMultipleBinary(MSGPath(self.__dir, filename))
342
341
 
343
342
  def getSingleOrMultipleString(self, filename: MSG_PATH) -> Optional[Union[List[str], str]]:
344
343
  """
@@ -356,7 +355,7 @@ class AttachmentBase(abc.ABC):
356
355
  """
357
356
  if (msg := self.__msg()) is None:
358
357
  raise ReferenceError('The MSGFile for this Attachment instance has been garbage collected.')
359
- return msg.getSingleOrMultipleString([self.__dir, msgPathToString(filename)])
358
+ return msg.getSingleOrMultipleString(MSGPath(self.__dir, filename))
360
359
 
361
360
  def getStream(self, filename: MSG_PATH) -> Optional[bytes]:
362
361
  """
@@ -370,7 +369,7 @@ class AttachmentBase(abc.ABC):
370
369
  """
371
370
  if (msg := self.__msg()) is None:
372
371
  raise ReferenceError('The MSGFile for this Attachment instance has been garbage collected.')
373
- return msg.getStream([self.__dir, msgPathToString(filename)])
372
+ return msg.getStream(MSGPath(self.__dir, filename))
374
373
 
375
374
  def getStreamAs(self, streamID: MSG_PATH, overrideClass: OVERRIDE_CLASS[_T]) -> Optional[_T]:
376
375
  """
@@ -407,7 +406,7 @@ class AttachmentBase(abc.ABC):
407
406
  """
408
407
  if (msg := self.__msg()) is None:
409
408
  raise ReferenceError('The MSGFile for this Attachment instance has been garbage collected.')
410
- return msg.getStringStream([self.__dir, msgPathToString(filename)])
409
+ return msg.getStringStream(MSGPath(self.__dir, filename))
411
410
 
412
411
  def getStringStreamAs(self, streamID: MSG_PATH, overrideClass: OVERRIDE_CLASS[_T]) -> Optional[_T]:
413
412
  """
@@ -428,7 +427,7 @@ class AttachmentBase(abc.ABC):
428
427
 
429
428
  return value
430
429
 
431
- def listDir(self, streams: bool = True, storages: bool = False) -> List[List[str]]:
430
+ def listDir(self, streams: bool = True, storages: bool = False) -> Tuple[MSGPath, ...]:
432
431
  """
433
432
  Lists the streams and/or storages that exist in the attachment
434
433
  directory.
@@ -438,14 +437,15 @@ class AttachmentBase(abc.ABC):
438
437
  """
439
438
  if (msg := self.__msg()) is None:
440
439
  raise ReferenceError('The MSGFile for this Attachment instance has been garbage collected.')
441
- return [path[1:] for path in msg.listDir(streams, storages, False)
442
- if len(path) > 1 and path[0] == self.__dir]
440
+ return tuple(path.relative_to(self.__dir)
441
+ for path in msg.listDir(streams, storages, False)
442
+ if path.is_relative_to(self.__dir))
443
443
 
444
- def slistDir(self, streams: bool = True, storages: bool = False) -> List[str]:
444
+ def slistDir(self, streams: bool = True, storages: bool = False) -> Tuple[str, ...]:
445
445
  """
446
446
  Like listDir, except it returns the paths as strings.
447
447
  """
448
- return ['/'.join(path) for path in self.listDir(streams, storages)]
448
+ return Tuple(str(path) for path in self.listDir(streams, storages))
449
449
 
450
450
  @abc.abstractmethod
451
451
  def save(self, **kwargs) -> SAVE_TYPE:
@@ -512,9 +512,9 @@ class AttachmentBase(abc.ABC):
512
512
  dataStream = None
513
513
 
514
514
  if self.exists('__substg1.0_3701000D'):
515
- dataStream = [self.__dir, '__substg1.0_3701000D']
515
+ dataStream = self.__dir / '__substg1.0_3701000D'
516
516
  elif self.exists('__substg1.0_37010102'):
517
- dataStream = [self.__dir, '__substg1.0_37010102']
517
+ dataStream = self.__dir / '__substg1.0_37010102'
518
518
 
519
519
  # If we found the right item, get the CLSID.
520
520
  if dataStream:
@@ -12,11 +12,10 @@ import functools
12
12
  from typing import Dict, Optional, TYPE_CHECKING, TypeVar
13
13
 
14
14
  from ...constants import MSG_PATH, OVERRIDE_CLASS
15
+ from ...msg_path import MSGPath
15
16
  from ...structures.odt import ODTStruct
16
17
  from ...structures.ole_pres import OLEPresentationStream
17
18
  from ...structures.ole_stream_struct import OleStreamStruct
18
- from ...utils import msgPathToString
19
-
20
19
 
21
20
  if TYPE_CHECKING:
22
21
  from ..attachment_base import AttachmentBase
@@ -38,7 +37,7 @@ class CustomAttachmentHandler(abc.ABC):
38
37
  """
39
38
  Gets a stream from the custom data directory.
40
39
  """
41
- return self.attachment.getStream('__substg1.0_3701000D/' + msgPathToString(filename))
40
+ return self.attachment.getStream(MSGPath('__substg1.0_3701000D/', filename))
42
41
 
43
42
  def getStreamAs(self, streamID: MSG_PATH, overrideClass: OVERRIDE_CLASS[_T]) -> Optional[_T]:
44
43
  """
@@ -33,6 +33,7 @@ __all__ = [
33
33
  'MULTIPLE_8_BYTES_HEX',
34
34
  'NEEDS_ARG',
35
35
  'NULL_DATE',
36
+ 'PROPERTIES',
36
37
  'PTYPES',
37
38
  'PYTPFLOATINGTIME_START',
38
39
  'REFUSED_CLASS_TYPES',
@@ -50,6 +51,7 @@ from typing import (
50
51
 
51
52
  from . import ps, re, st
52
53
  from ..enums import SaveType
54
+ from ..msg_path import MSGPath
53
55
  from ..null_date import NullDate
54
56
 
55
57
 
@@ -66,7 +68,7 @@ HEADER_FORMAT_VALUE_TYPE = Union[str, Tuple[Union[str, None], bool], None]
66
68
  # Basically a dict of HEADER_FORMAT_TYPE and dicts containing them.
67
69
  HEADER_FORMAT_TYPE = Optional[Dict[str, Union[HEADER_FORMAT_VALUE_TYPE, Dict[str, HEADER_FORMAT_VALUE_TYPE]]]]
68
70
  SAVE_TYPE = Tuple[SaveType, Union[List[str], str, None]]
69
- MSG_PATH = Union[str, List[str], Tuple[str, ...]]
71
+ MSG_PATH = Union[MSGPath, str, List[str], Tuple[str, ...]]
70
72
  # Type used for the getXAs methods' overrideClass argument.
71
73
  OVERRIDE_CLASS = Union[Type[_T], Callable[[Any], _T]]
72
74
 
@@ -292,4 +294,220 @@ PTYPES: Final[Dict[int, str]]= {
292
294
  0x1102: 'PtypMultipleBinary',
293
295
  }
294
296
 
297
+ # This property information was sourced from
298
+ # http://www.fileformat.info/format/outlookmsg/index.htm
299
+ # on 2013-07-22.
300
+ # It was extended by The Elemental of Destruction on 2018-10-12.
301
+ PROPERTIES = {
302
+ '00010102': 'Template data',
303
+ '0002000B': 'Alternate recipient allowed',
304
+ '0004001F': 'Auto forward comment',
305
+ '00040102': 'Script data',
306
+ '0005000B': 'Auto forwarded',
307
+ '000F000F': 'Deferred delivery time',
308
+ '00100040': 'Deliver time',
309
+ '00150040': 'Expiry time',
310
+ '00170003': 'Importance',
311
+ '001A001F': 'Message class',
312
+ '0023001F': 'Originator delivery report requested',
313
+ '00250102': 'Parent key',
314
+ '00260003': 'Priority',
315
+ '0029000B': 'Read receipt requested',
316
+ '002A0040': 'Receipt time',
317
+ '002B000B': 'Recipient reassignment prohibited',
318
+ '002E0003': 'Original sensitivity',
319
+ '00300040': 'Reply time',
320
+ '00310102': 'Report tag',
321
+ '00320040': 'Report time',
322
+ '00360003': 'Sensitivity',
323
+ '0037001F': 'Subject',
324
+ '00390040': 'Client Submit Time',
325
+ '003A001F': '',
326
+ '003B0102': '',
327
+ '003D001F': 'Subject prefix',
328
+ '003F0102': '',
329
+ '0040001F': 'Received by name',
330
+ '00410102': '',
331
+ '0042001F': 'Sent repr name',
332
+ '00430102': '',
333
+ '0044001F': 'Rcvd repr name',
334
+ '00450102': '',
335
+ '0046001F': '',
336
+ '00470102': '',
337
+ '0049001F': '',
338
+ '004B001F': '',
339
+ '004C0102': '',
340
+ '004D001F': 'Org author name',
341
+ '004E0040': '',
342
+ '004F0102': '',
343
+ '0050001F': 'Reply rcipnt names',
344
+ '00510102': '',
345
+ '00520102': '',
346
+ '00530102': '',
347
+ '00540102': '',
348
+ '00550040': '',
349
+ '0057000B': '',
350
+ '0058000B': '',
351
+ '0059000B': '',
352
+ '005A001F': 'Org sender name',
353
+ '005B0102': '',
354
+ '005C0102': '',
355
+ '005D001F': '',
356
+ '005E0102': '',
357
+ '005F0102': '',
358
+ '00600040': '',
359
+ '00610040': '',
360
+ '00620003': '',
361
+ '0063000B': '',
362
+ '0064001F': 'Sent repr adrtype',
363
+ '0065001F': 'Sent repr email',
364
+ '0066001F': '',
365
+ '00670102': '',
366
+ '0068001F': '',
367
+ '0069001F': '',
368
+ '0070001F': 'Topic',
369
+ '00710102': '',
370
+ '0072001F': '',
371
+ '0073001F': '',
372
+ '0074001F': '',
373
+ '0075001F': 'Rcvd by adrtype',
374
+ '0076001F': 'Rcvd by email',
375
+ '0077001F': 'Repr adrtype',
376
+ '0078001F': 'Repr email',
377
+ '007D001F': 'Message header',
378
+ '007F0102': '',
379
+ '0080001F': '',
380
+ '0081001F': '',
381
+ '08070003': '',
382
+ '0809001F': '',
383
+ '0C040003': '',
384
+ '0C050003': '',
385
+ '0C06000B': '',
386
+ '0C08000B': '',
387
+ '0C150003': '',
388
+ '0C17000B': '',
389
+ '0C190102': '',
390
+ '0C1A001F': 'Sender name',
391
+ '0C1B001F': '',
392
+ '0C1D0102': '',
393
+ '0C1E001F': 'Sender adr type',
394
+ '0C1F001F': 'Sender email',
395
+ '0C200003': '',
396
+ '0C21001F': '',
397
+ '0E01000B': '',
398
+ '0E02001F': 'Display BCC',
399
+ '0E03001F': 'Display CC',
400
+ '0E04001F': 'Display To',
401
+ '0E060040': '',
402
+ '0E070003': '',
403
+ '0E080003': '',
404
+ '0E080014': '',
405
+ '0E090102': '',
406
+ '0E0F000B': '',
407
+ '0E12000D': '',
408
+ '0E13000D': '',
409
+ '0E170003': '',
410
+ '0E1B000B': '',
411
+ '0E1D001F': 'Subject (normalized)',
412
+ '0E1F000B': '',
413
+ '0E200003': '',
414
+ '0E210003': '',
415
+ '0E28001F': 'Recvd account1 (uncertain)',
416
+ '0E29001F': 'Recvd account2 (uncertain)',
417
+ '1000001F': 'Message body',
418
+ '1008': 'RTF sync body tag', # Where did this come from ??? It's not listed in the docs
419
+ '10090102': 'Compressed RTF body',
420
+ '1013001F': 'HTML body',
421
+ '1035001F': 'Message ID (uncertain)',
422
+ '1046001F': 'Sender email (uncertain)',
423
+ '3001001F': 'Display name',
424
+ '3002001F': 'Address type',
425
+ '3003001F': 'Email address',
426
+ '30070040': 'Creation date',
427
+ '39FE001F': '7-bit email (uncertain)',
428
+ '39FF001F': '7-bit display name',
429
+
430
+ # Attachments (37xx)
431
+ '37010102': 'Attachment data',
432
+ '37020102': '',
433
+ '3703001F': 'Attachment extension',
434
+ '3704001F': 'Attachment short filename',
435
+ '37050003': 'Attachment attach method',
436
+ '3707001F': 'Attachment long filename',
437
+ '370E001F': 'Attachment mime tag',
438
+ '3712001F': 'Attachment ID (uncertain)',
439
+
440
+ # Address book (3Axx):
441
+ '3A00001F': 'Account',
442
+ '3A02001F': 'Callback phone no',
443
+ '3A05001F': 'Generation',
444
+ '3A06001F': 'Given name',
445
+ '3A08001F': 'Business phone',
446
+ '3A09001F': 'Home phone',
447
+ '3A0A001F': 'Initials',
448
+ '3A0B001F': 'Keyword',
449
+ '3A0C001F': 'Language',
450
+ '3A0D001F': 'Location',
451
+ '3A11001F': 'Surname',
452
+ '3A15001F': 'Postal address',
453
+ '3A16001F': 'Company name',
454
+ '3A17001F': 'Title',
455
+ '3A18001F': 'Department',
456
+ '3A19001F': 'Office location',
457
+ '3A1A001F': 'Primary phone',
458
+ '3A1B101F': 'Business phone 2',
459
+ '3A1C001F': 'Mobile phone',
460
+ '3A1D001F': 'Radio phone no',
461
+ '3A1E001F': 'Car phone no',
462
+ '3A1F001F': 'Other phone',
463
+ '3A20001F': 'Transmit dispname',
464
+ '3A21001F': 'Pager',
465
+ '3A220102': 'User certificate',
466
+ '3A23001F': 'Primary Fax',
467
+ '3A24001F': 'Business Fax',
468
+ '3A25001F': 'Home Fax',
469
+ '3A26001F': 'Country',
470
+ '3A27001F': 'Locality',
471
+ '3A28001F': 'State/Province',
472
+ '3A29001F': 'Street address',
473
+ '3A2A001F': 'Postal Code',
474
+ '3A2B001F': 'Post Office Box',
475
+ '3A2C001F': 'Telex',
476
+ '3A2D001F': 'ISDN',
477
+ '3A2E001F': 'Assistant phone',
478
+ '3A2F001F': 'Home phone 2',
479
+ '3A30001F': 'Assistant',
480
+ '3A44001F': 'Middle name',
481
+ '3A45001F': 'Dispname prefix',
482
+ '3A46001F': 'Profession',
483
+ '3A47001F': '',
484
+ '3A48001F': 'Spouse name',
485
+ '3A4B001F': 'TTYTTD radio phone',
486
+ '3A4C001F': 'FTP site',
487
+ '3A4E001F': 'Manager name',
488
+ '3A4F001F': 'Nickname',
489
+ '3A51001F': 'Business homepage',
490
+ '3A57001F': 'Company main phone',
491
+ '3A58101F': 'Childrens names',
492
+ '3A59001F': 'Home City',
493
+ '3A5A001F': 'Home Country',
494
+ '3A5B001F': 'Home Postal Code',
495
+ '3A5C001F': 'Home State/Provnce',
496
+ '3A5D001F': 'Home Street',
497
+ '3A5F001F': 'Other adr City',
498
+ '3A60': 'Other adr Country',
499
+ '3A61': 'Other adr PostCode',
500
+ '3A62': 'Other adr Province',
501
+ '3A63': 'Other adr Street',
502
+ '3A64': 'Other adr PO box',
503
+
504
+ '3FF7': 'Server (uncertain)',
505
+ '3FF8': 'Creator1 (uncertain)',
506
+ '3FFA': 'Creator2 (uncertain)',
507
+ '3FFC': 'To email (uncertain)',
508
+ '403D': 'To adrtype (uncertain)',
509
+ '403E': 'To email (uncertain)',
510
+ '5FF6': 'To (uncertain)',
511
+ }
512
+
295
513
  # END CONSTANTS.