mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-09 22:38:19 +02:00
Prevent ImapTransport from raising exception when no messages are available. Fixes #24. Release 3.4.1.
This commit is contained in:
parent
3ffbcea3bf
commit
7474cf0118
2 changed files with 8 additions and 2 deletions
|
|
@ -36,7 +36,13 @@ class ImapTransport(EmailTransport):
|
|||
def _get_all_message_ids(self):
|
||||
# Fetch all the message uids
|
||||
response, message_ids = self.server.uid('search', None, 'ALL')
|
||||
return message_ids[0].split(' ')
|
||||
message_id_string = message_ids[0].strip()
|
||||
# Usually `message_id_string` will be a list of space-separated
|
||||
# ids; we must make sure that it isn't an empty string before
|
||||
# splitting into individual UIDs.
|
||||
if message_id_string:
|
||||
return message_id_string.split(' ')
|
||||
return []
|
||||
|
||||
def _get_small_message_ids(self, message_ids):
|
||||
# Using existing message uids, get the sizes and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue