mirror of
https://github.com/python/cpython.git
synced 2025-08-21 17:25:34 +00:00
[Backport of r56382]
Avoid exception if there's a stray directory inside a Maildir folder. The Maildir specification doesn't seem to say anything about this situation, and it can happen if you're keeping a Maildir mailbox in Subversion (.svn directories) or some similar system. The patch just ignores directories in the cur/, new/, tmp/ folders.
This commit is contained in:
parent
0336870720
commit
6ecd4a0535
3 changed files with 19 additions and 1 deletions
|
@ -459,7 +459,11 @@ class Maildir(Mailbox):
|
|||
"""Update table of contents mapping."""
|
||||
self._toc = {}
|
||||
for subdir in ('new', 'cur'):
|
||||
for entry in os.listdir(os.path.join(self._path, subdir)):
|
||||
subdir_path = os.path.join(self._path, subdir)
|
||||
for entry in os.listdir(subdir_path):
|
||||
p = os.path.join(subdir_path, entry)
|
||||
if os.path.isdir(p):
|
||||
continue
|
||||
uniq = entry.split(self.colon)[0]
|
||||
self._toc[uniq] = os.path.join(subdir, entry)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue