From 7adc86b055e484e695b12a48771cca34d591af9e Mon Sep 17 00:00:00 2001 From: gdesmar <75089569+gdesmar@users.noreply.github.com> Date: Mon, 20 Mar 2023 12:38:44 +0000 Subject: [PATCH 1/2] Fix typo in the Props rawData references --- extract_msg/prop.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extract_msg/prop.py b/extract_msg/prop.py index 2c7b3809..8d2765f6 100644 --- a/extract_msg/prop.py +++ b/extract_msg/prop.py @@ -78,7 +78,7 @@ def rawData(self) -> bytes: """ The raw bytes used to create this object. """ - return self.__raw + return self.__rawData @property def type(self) -> int: @@ -152,7 +152,7 @@ def parseType(self, _type : int, stream : bytes) -> Any: value = filetimeToDatetime(rawTime) except ValueError as e: logger.exception(e) - logger.error(self.raw) + logger.error(self.rawData) elif _type == 0x0048: # PtypGuid # TODO parsing for this pass From b0079542386fa11c29274f7397902670862334f5 Mon Sep 17 00:00:00 2001 From: gdesmar <75089569+gdesmar@users.noreply.github.com> Date: Mon, 20 Mar 2023 13:04:49 +0000 Subject: [PATCH 2/2] ErrorType -> ErrorCode Typo in Props and Utils --- extract_msg/enums.py | 2 +- extract_msg/prop.py | 4 +--- extract_msg/utils.py | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/extract_msg/enums.py b/extract_msg/enums.py index 8c4986f2..4ab563cc 100644 --- a/extract_msg/enums.py +++ b/extract_msg/enums.py @@ -400,7 +400,7 @@ def fromBits(cls, value : int) -> Set['ElectronicAddressProperties']: raise ValueError('Value must not be negative.') # This is a quick compressed way to convert the bits in the int into # a tuple of instances of this class should any bit be a 1. - return {cls(int(x)) for index, val in enumerate(bin(value)[:1:-1]) if val == '1'} + return {cls(int(index)) for index, val in enumerate(bin(value)[:1:-1]) if val == '1'} EMAIL_1 = 0x00000000 EMAIL_2 = 0x00000001 diff --git a/extract_msg/prop.py b/extract_msg/prop.py index 8d2765f6..8cf61a80 100644 --- a/extract_msg/prop.py +++ b/extract_msg/prop.py @@ -1,8 +1,6 @@ import datetime import logging -import olefile - from typing import Any from . import constants @@ -139,7 +137,7 @@ def parseType(self, _type : int, stream : bytes) -> Any: # wasn't. So we are just returning the int. However, we want to see # if it is a normal error type. try: - logger.warning(f'REPORT TO DEVELOPERS: Error type of {ErrorType(value)} was found.') + logger.warning(f'REPORT TO DEVELOPERS: Error type of {ErrorCode(value)} was found.') except ValueError: pass elif _type == 0x000B: # PtypBoolean diff --git a/extract_msg/utils.py b/extract_msg/utils.py index 52668210..4abd3e7d 100644 --- a/extract_msg/utils.py +++ b/extract_msg/utils.py @@ -794,7 +794,7 @@ def parseType(_type : int, stream, encoding, extras): # wasn't. So we are just returning the int. However, we want to see # if it is a normal error type. try: - logger.warning(f'REPORT TO DEVELOPERS: Error type of {ErrorType(value)} was found.') + logger.warning(f'REPORT TO DEVELOPERS: Error type of {ErrorCode(value)} was found.') except ValueError: pass return value