Skip to content

Commit

Permalink
enhanced robustness - skip empty attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWillner committed Dec 29, 2020
1 parent 154ab29 commit 7c39263
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mailbox_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def download_attachment(self, part, date) -> str:
file_attached, part.get_content_maintype())
logging.debug(' Downl.\t: To "%s"', file_temp.name)
payload = part.get_payload(decode=True)
if payload is None:
return None
file_temp.write(payload)
file_temp.flush()
target = self._copy_file(file_temp.name, file_attached, date)
Expand Down

0 comments on commit 7c39263

Please sign in to comment.