[PATCH] imaputil.py: Improved fix for quote detection regex

Richard Tollerton rich.tollerton at ni.com
Mon Jul 15 22:22:23 BST 2013


Lotus Notes/Domino likes to return quoted strings of the form '"\\\\"', which
when unescaped, ought to produce '"\\"'. The previous attempted fix didn't
*quite*; this regex is ripped directly from Friedl.

Signed-off-by: Richard Tollerton <rich.tollerton at ni.com>
---
 offlineimap/imaputil.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/offlineimap/imaputil.py b/offlineimap/imaputil.py
index fe69b7a..9fb5946 100644
--- a/offlineimap/imaputil.py
+++ b/offlineimap/imaputil.py
@@ -23,7 +23,7 @@ from offlineimap.ui import getglobalui
 
 # find the first quote in a string
 quotere = re.compile(
-    r"""(?P<quote>"[^\"\\]*(?:\\"|[^"])*") # Quote, possibly containing encoded
+    r"""(?P<quote>"[^"\\]*(?:\\.[^"\\]*)*") # Quote, possibly containing encoded
                                    # quotation mark
         \s*(?P<rest>.*)$           # Whitespace & remainder of string""",
     re.VERBOSE)
-- 
1.8.3.2





More information about the OfflineIMAP-project mailing list