jeremyephron / simplegmail

A simple Gmail API client for applications in Python
MIT License
348 stars 74 forks source link

Fix for another unhandled 'KeyError' exception #26

Closed roib20 closed 3 years ago

roib20 commented 3 years ago

This commit fixes an additional KeyError bug in gmail.py.

Explanation of the bug: in rare cases where a "payload" dict object is missing a 'parts' key, an unhandled KeyError exception is caused by the for part in payload['parts'] statement under the _evaluate_message_payload function.

Fix: This commit fixes the KeyError bug by adding the if 'parts' in payload statement, ensuring that the key exists in the payload dictionary before proceeding.

roib20 commented 3 years ago

In the meantime I found and fixed another, different bug. I want to PR it as well but was hoping this could get merged first, to avoid any possible conflicts.

jeremyephron commented 3 years ago

In the meantime I found and fixed another, different bug. I want to PR it as well but was hoping this could get merged first, to avoid any possible conflicts.

Whatever you prefer is fine, but it's also totally okay to submit multiple PRs, and let me worry about resolving merge conflicts.