/offlineimap/head: changeset 293
Now properly handles folder names that contain parenthesis. Used patch from Kyler Laird in http://bugs.debian.org/cgi- bin/bugreport.cgi?bug=173895. Closes: #173895.
This commit is contained in:
@ -112,8 +112,14 @@ def imapsplit(imapstring):
|
||||
retval = []
|
||||
while len(workstr):
|
||||
if workstr[0] == '(':
|
||||
# Needs rindex to properly process eg (FLAGS () UID 123)
|
||||
rpareni = workstr.rindex(')') + 1
|
||||
rparenc = 1 # count of right parenthesis to match
|
||||
rpareni = 1 # position to examine
|
||||
while rparenc: # Find the end of the group.
|
||||
if workstr[rpareni] == ')': # end of a group
|
||||
rparenc -= 1
|
||||
elif workstr[rpareni] == '(': # start of a group
|
||||
rparenc += 1
|
||||
rpareni += 1 # Move to next character.
|
||||
parenlist = workstr[0:rpareni]
|
||||
workstr = workstr[rpareni:].lstrip()
|
||||
retval.append(parenlist)
|
||||
|
Reference in New Issue
Block a user