BUG: git-current crashing with "string index out of range"
Florin Boariu
florin.ml at rootshell.ro
Fri Mar 29 22:14:47 GMT 2013
Hi again,
> Hi Florian,
> You didn't attach your patch !
> If you did attach it, the mailing list app removed the attachment, so
> copy/paste in the body and resend!
>
Sorry. Here it is:
---CUT-HERE---
diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py
index 75520c2..ce7e8ee 100644
--- a/offlineimap/folder/IMAP.py
+++ b/offlineimap/folder/IMAP.py
@@ -240,7 +240,14 @@ class IMAPFolder(BaseFolder):
# data looks now e.g. [('320 (UID 17061 BODY[]
# {2565}','msgbody....')] we only asked for one message,
# and that msg is in data[0]. msbody is in [0][1]
- data = data[0][1].replace("\r\n", "\n")
+ #
+ # Sometimes imapobj.uid() fails, leaving data=[')']
+ # Catch these and get noisy about it in the logs.
+ #
+ if len(data) <= 1:
+ data = "(server response has unexpected shape: %s...)" %
(data[0][:50])
+ else:
+ data = data[0][1].replace("\r\n", "\n")
if len(data)>200:
dbg_output = "%s...%s" % (str(data)[:150],
---CUT-HERE---
Regards,
Florin.
More information about the OfflineIMAP-project
mailing list