From a134301ac505678593a42ac8c483cf1b42ad6bad Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Tue, 21 Aug 2012 16:48:26 +0200 Subject: [PATCH] Improve 'find first quotation' regex Reported by http://www.dfranke.com/blog/2012/08/20/offlineimap-error-beim-syncen-mit-lotus-domino/ our 'find the first quote possible containing encoded quotation marks' regex did not seem to have caught all cases. E.g. "\\". Verified the fix as good. Thanks Daniel Franke. Signed-off-by: Sebastian Spaeth --- Changelog.rst | 2 ++ offlineimap/imaputil.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Changelog.rst b/Changelog.rst index aa0d903..f126075 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -15,6 +15,8 @@ WIP (add new stuff for the next release) * Fix str.format() calls for Python 2.6 (D. Logie) * Remove APPENDUID hack, previously introduced to fix Gmail, no longer necessary, it might have been breaking things. (J. Wiegley) +* Improve regex that could lead to 'NoneType' object has no attribute 'group' + (D. Franke) OfflineIMAP v6.5.4 (2012-06-02) =============================== diff --git a/offlineimap/imaputil.py b/offlineimap/imaputil.py index 557064b..fe69b7a 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, possibly containing encoded + r"""(?P"[^\"\\]*(?:\\"|[^"])*") # Quote, possibly containing encoded # quotation mark \s*(?P.*)$ # Whitespace & remainder of string""", re.VERBOSE)