[Twisted-Python] PATCH: imap4.py: fix when calling splitQuoted on empty string

Abe Fettig abe at fettig.net
Mon Jun 30 10:19:21 EDT 2003


To get a list of all folders, Evolution's IMAP client uses this syntax:

LIST "" ""

This results in an error, since the "" "" part goes through splitQuoted
twice (once in IMAP4Server.listWork, the second in
IMAP4Server._parseMbox).  The second time through the quotes have been
removed (leaving an empty string), which causes splitQuoted to return []
instead of [''].

I've attached a simple patch that demonstrates one possible way to fix
the problem.

Abe

-------------- next part --------------
--- imap4.py-cvs	2003-06-30 10:05:03.000000000 -0400
+++ imap4.py	2003-06-30 09:54:49.000000000 -0400
@@ -2547,6 +2547,8 @@
     @raise MismatchedQuoting: Raised if an odd number of quotes are present
     """
     s = s.strip()
+    if s == '': return ['']
+
     result = []
     inQuote = inWord = start = 0
     for (i, c) in zip(range(len(s)), s):


More information about the Twisted-Python mailing list