From 137e11c88e0af8bb4c5fd9392f8a5ebf4b254f39 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Sat, 7 Jan 2012 23:26:02 +0100 Subject: [PATCH] Improve previous comment & Changelog Add a changelog to W. Trevor King's previous commit. Also make wording a bit more consistent and and remove a now unneeded comparison (dirname is always set when extension is set). Signed-off-by: Sebastian Spaeth --- Changelog.draft.rst | 2 ++ offlineimap/repository/Maildir.py | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Changelog.draft.rst b/Changelog.draft.rst index 73c0da0..1b9f8f6 100644 --- a/Changelog.draft.rst +++ b/Changelog.draft.rst @@ -24,3 +24,5 @@ Bug Fixes --------- * Fix possible crash during --info run +* Fix reading in Maildirs, where we would attempt to create empty + directories on REMOTE. diff --git a/offlineimap/repository/Maildir.py b/offlineimap/repository/Maildir.py index bb384c2..66a3ebd 100644 --- a/offlineimap/repository/Maildir.py +++ b/offlineimap/repository/Maildir.py @@ -151,20 +151,23 @@ class MaildirRepository(BaseRepository): for dirname in os.listdir(toppath) + ['']: self.debug(" dirname = %s" % dirname) if dirname == '' and extension is not None: - self.debug(' skip this entry (extension set)') + self.debug(' skip this entry (already scanned)') continue if dirname in ['cur', 'new', 'tmp']: - self.debug(" skipping this dir (Maildir special)") + self.debug(" skip this entry (Maildir special)") # Bypass special files. continue fullname = os.path.join(toppath, dirname) if not os.path.isdir(fullname): - self.debug(" skipping this entry (not a directory)") + self.debug(" skip this entry (not a directory)") # Not a directory -- not a folder. continue - foldername = dirname - if extension and dirname != '': + if extension: + # extension can be None which fails. foldername = os.path.join(extension, dirname) + else: + foldername = dirname + if (os.path.isdir(os.path.join(fullname, 'cur')) and os.path.isdir(os.path.join(fullname, 'new')) and os.path.isdir(os.path.join(fullname, 'tmp'))):