Ticket #29 (closed defect: fixed)

Opened 7 months ago

Last modified 5 months ago

fetch ENVELOPE doesn't work with gmail

Reported by: eichin@… Owned by: menno
Priority: critical Milestone: 0.6
Version: Keywords: gmail
Cc: eichin@…

Description (last modified by menno) (diff)

>>> server.select_folder('william')
7L
>>> server.fetch(1, ("ENVELOPE",))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "imapclient/imapclient.py", line 436, in fetch
    return parser(data)
  File "imapclient/imapclient.py", line 573, in parse
    msgid, data = self.parse_data(response_item)
  File "imapclient/imapclient.py", line 614, in parse_data
    for name, item in FetchTokeniser().process_pairs(data):
  File "imapclient/imapclient.py", line 699, in process_pairs
    for m in strict_finditer(self.PAIR_RE, s):
  File "imapclient/imapclient.py", line 763, in strict_finditer
    "%r before -- %r remains" % (s[:i], s[i:]))
ValueError: failed to match all of input. 'UID 1 ENVELOPE ("Fri, 16 Jul 2004 15:59:43 -0400" "on my way" (("Mark Eichin" NIL "eichin" "gmail.com")' before -- ') (("Mark Eichin" NIL "eichin" "gmail.com")) (("Mark Eichin" NIL "eichin" "gmail.com")) (("Other Person" NIL "..." "...")) NIL NIL NIL "<f2e30b5f04071612593d641920@mail.gmail.com>")' remains

(email address parts elided from one of the strings, but the match has already failed at that point. Also, this is with strict_finditer tweaked as-shown so you can see the successful part of the match as well as the failed part...)

It appears that this is what keeps fetch(1, ("ALL",)) from working, as well, it hits the ValueError in the same place at least, and the other parts of ALL work when fetched individually.

Change History

Changed 7 months ago by menno

  • description modified (diff)

Changed 7 months ago by menno

  • owner set to menno
  • priority changed from major to critical
  • status changed from new to accepted
  • milestone set to 0.6

#1 will fix this problem and a bunch of others.

Leaving this ticket open to ensure that tests get written for ENVELOPE.

Changed 6 months ago by menno

Now that #1 has been done the current trunk looks good wrt to the bug. Still need to write some automated tests however.

Changed 5 months ago by menno

  • status changed from accepted to closed
  • resolution set to fixed

Tests added in 5ea0fc2ddb18

Note: See TracTickets for help on using tickets.