]> khamidou — GitHub mirrors - imapclient.git/commitdiff
Handle both types of quoted specials
authormsmits@ubuntu.ubuntu-domain <msmits@ubuntu.ubuntu-domain>
Mon, 28 Dec 2009 19:10:33 +0000 (13:10 -0600)
committermsmits@ubuntu.ubuntu-domain <msmits@ubuntu.ubuntu-domain>
Mon, 28 Dec 2009 19:10:33 +0000 (13:10 -0600)
imapclient/imapclient.py
imapclient/test/test_IMAPClient.py

index a75396755fee302d048ab0ca6722441a358563dc..22c45b1eafccf7c37266900379df511742e9fc5e 100644 (file)
@@ -191,6 +191,7 @@ class IMAPClient(object):
                 if match:
                     folder_text = match.group('folder')
                     folder_text = folder_text.replace(r'\"', '"')
+                    folder_text = folder_text.replace(r'\\', '\\')
             if folder_text is not None:
                 folders.append(self._decode_folder_name(folder_text))
         return folders
index a3c5b43296de8f56d1187e365c194835d42cec4a..212daa0da41a62cb5267858c4f6f9abc8d1ea595 100644 (file)
@@ -82,16 +82,14 @@ class TestListFolders(IMAPClientTest):
         self.assert_(folders == ['bang\xff', 'INBOX'], 'got %r' % folders)
 
 
-    def test_escaped_quotes(self):
+    def test_quoted_specials(self):
         folders = self.client._proc_folder_list(['(\\HasNoChildren) "/" "Test \"Folder\""',
                                                  '(\\HasNoChildren) "/" "Left\"Right"',
+                                                r'(\\HasNoChildren) "/" "Left\\Right"',
                                                  ])
-        self.assert_(folders == ['Test "Folder"', 'Left\"Right'], 'got %r' % folders)
+        self.assert_(folders == ['Test "Folder"', 'Left\"Right', r'Left\Right'], 'got %r' % folders)
 
 
-    def test_other_escaping(self):
-        self.fail("what other escapes are allowed?")
-
 
 class TestAppend(IMAPClientTest):