diff --git a/offlineimap/repository/Base.py b/offlineimap/repository/Base.py index 8634628..a2fd403 100644 --- a/offlineimap/repository/Base.py +++ b/offlineimap/repository/Base.py @@ -189,11 +189,12 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object): dst_hash[folder.getvisiblename().replace( dst_repo.getsep(), src_repo.getsep())] = folder - # Find new folders on src_repo. + # Find and create new folders on src_repo. for src_name_t, src_folder in src_hash.iteritems(): # Don't create on dst_repo, if it is readonly if not dst_repo.get_create_folders(): break + if src_folder.sync_this and not src_name_t in dst_folders: try: dst_repo.makefolder(src_name_t) @@ -205,7 +206,7 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object): raise status_repo.makefolder(src_name_t.replace(dst_repo.getsep(), status_repo.getsep())) - # Find new folders on dst_repo. + # Find and create new folders on dst_repo. for dst_name_t, dst_folder in dst_hash.iteritems(): if not src_repo.get_create_folders(): # Don't create missing folder on readonly repo. diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index 60d5a08..c2e58e0 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -457,9 +457,12 @@ class IMAPRepository(BaseRepository): :param foldername: Full path of the folder to be created.""" + if foldername is '': + return + if self.getreference(): foldername = self.getreference() + self.getsep() + foldername - if not foldername: # Create top level folder as folder separator + if not foldername: # Create top level folder as folder separator. foldername = self.getsep() self.ui.makefolder(self, foldername) if self.account.dryrun: