Skip to content

Commit

Permalink
fix: Avoid exception on broken MSG file
Browse files Browse the repository at this point in the history
Related #778
  • Loading branch information
Rafiot committed Jan 24, 2025
1 parent db9431f commit d68068c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pandora/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,11 @@ def observables(self) -> dict[str, set[str]]:
if body['content_type'] == 'text/html':
observables['url'].update(self.__extract_urls_from_html(body['content']))
elif self.msg_data:
if self.msg_data.htmlBody:
observables['url'].update(self.__extract_urls_from_html(self.msg_data.htmlBody.decode()))
try:
if self.msg_data.htmlBody:
observables['url'].update(self.__extract_urls_from_html(self.msg_data.htmlBody.decode()))
except Exception as e:
self.logger.warning(f'Unable to process HTML body in MSG file {self.uuid}: {e}')

elif self.is_pdf and self.data:
try:
Expand Down

0 comments on commit d68068c

Please sign in to comment.