classification
Title: Update imaplib.py to account for additional padding
Type: behavior Stage:
Components: email Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: barry, edwardmbsmith, r.david.murray
Priority: normal Keywords:

Created on 2019-06-26 05:28 by edwardmbsmith, last changed 2019-06-26 05:28 by edwardmbsmith.

Pull Requests
URL Status Linked Edit
PR 14388 open edwardmbsmith, 2019-06-26 05:28
Messages (1)
msg346584 - (view) Author: Edward Smith (edwardmbsmith) * Date: 2019-06-26 05:28
Regex for imaplib should account for IMAP servers which return one or two whitespaces after the * in responses. For example when using davmail as an interpreter between exchange to IMAP 

Acceptable response is as follows:
```
  58:24.54 > PJJD3 EXAMINE INBOX
  58:24.77 < * 486 EXISTS
  58:24.78      matched r'\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?' => ('486', 'EXISTS', None, None)
  58:24.78 untagged_responses[EXISTS] 0 += ["486"]
```
Davmail response:
```
57:50.86 > KPFE3 EXAMINE INBOX
  57:51.10 < *  953 EXISTS
  57:51.10 last 0 IMAP4 interactions:
  57:51.10 > KPFE4 LOGOUT
```

See additional whitespace after the * on line 2

To be fixed by allowing the regex to account for one or two whitespaces
```python
br'\*[ ]{1,2}(?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?'
```
History
Date User Action Args
2019-06-26 05:28:49edwardmbsmithcreate