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 <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2011-12-01 17:01:43 +01:00
parent 464342e1dd
commit 3bc68ecd65

View File

@ -162,7 +162,7 @@ class MaildirRepository(BaseRepository):
# Not a directory -- not a folder. # Not a directory -- not a folder.
continue continue
foldername = dirname foldername = dirname
if extension != None: if extension and dirname != '':
foldername = os.path.join(extension, dirname) foldername = os.path.join(extension, dirname)
if (os.path.isdir(os.path.join(fullname, 'cur')) and 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, 'new')) and
@ -187,7 +187,7 @@ class MaildirRepository(BaseRepository):
self.debug("_GETFOLDERS_SCANDIR RETURNING %s" % \ self.debug("_GETFOLDERS_SCANDIR RETURNING %s" % \
repr([x.getname() for x in retval])) repr([x.getname() for x in retval]))
return retval return retval
def getfolders(self): def getfolders(self):
if self.folders == None: if self.folders == None:
self.folders = self._getfolders_scandir(self.root) self.folders = self._getfolders_scandir(self.root)