From 9a654968fc6d73d3bc45b8191e5bae28ce51ac47 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Thu, 1 Dec 2011 17:01:43 +0100 Subject: [PATCH] Don't append trailing slash to maildir foldernames When sep='/' in a Maildir, we were doing a os.path.join(dirname,'') on the top level maildir, which results in a "dirname/", so all our maildir folder names had slashes appended. Which is pretty much wrong, so this fixes it by only using os.path.join when we actually have something to append. Signed-off-by: Sebastian Spaeth --- offlineimap/repository/Maildir.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/offlineimap/repository/Maildir.py b/offlineimap/repository/Maildir.py index 6e93839..70a5ca3 100644 --- a/offlineimap/repository/Maildir.py +++ b/offlineimap/repository/Maildir.py @@ -160,7 +160,7 @@ class MaildirRepository(BaseRepository): # Not a directory -- not a folder. continue foldername = dirname - if extension != None: + if extension and dirname != '': foldername = os.path.join(extension, dirname) if (os.path.isdir(os.path.join(fullname, 'cur')) and os.path.isdir(os.path.join(fullname, 'new')) and @@ -185,7 +185,7 @@ class MaildirRepository(BaseRepository): self.debug("_GETFOLDERS_SCANDIR RETURNING %s" % \ repr([x.getname() for x in retval])) return retval - + def getfolders(self): if self.folders == None: self.folders = self._getfolders_scandir(self.root)