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 <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-08-21 16:48:26 +02:00
parent 6e5fbebc0e
commit a134301ac5
2 changed files with 3 additions and 1 deletions

View File

@ -15,6 +15,8 @@ WIP (add new stuff for the next release)
* Fix str.format() calls for Python 2.6 (D. Logie) * Fix str.format() calls for Python 2.6 (D. Logie)
* Remove APPENDUID hack, previously introduced to fix Gmail, no longer * Remove APPENDUID hack, previously introduced to fix Gmail, no longer
necessary, it might have been breaking things. (J. Wiegley) 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) OfflineIMAP v6.5.4 (2012-06-02)
=============================== ===============================

View File

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