From 6b28071b0fa96610c065721778b0994491a32bf2 Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Sun, 26 Jun 2016 19:14:04 +0200 Subject: [PATCH] don't sync folders with local separator characters in their names Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/148 Signed-off-by: Nicolas Sebrecht --- offlineimap/accounts.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py index 8a9492e..67dddfb 100644 --- a/offlineimap/accounts.py +++ b/offlineimap/accounts.py @@ -347,11 +347,25 @@ class SyncableAccount(Account): self.ui.debug('', "Not syncing filtered folder '%s'" "[%s]"% (remotefolder, remoterepos)) continue # Ignore filtered folder. + + # The remote folder names must not have the local sep char in + # their names since this would cause troubles while converting + # the name back (from local to remote). + sep = localrepos.getsep() + if (sep != os.path.sep and + sep != remoterepos.getsep() and + sep in remotefolder.getvisiblename()): + self.ui.warn('', "Ignoring folder %s due to unsupported " + "'%s' character serving as local separator."% + (remotefolder.getvisiblename(), localrepos.getsep())) + continue # Ignore unsupported folder name. + localfolder = self.get_local_folder(remotefolder) if not localfolder.sync_this: self.ui.debug('', "Not syncing filtered folder '%s'" "[%s]"% (localfolder, localfolder.repository)) continue # Ignore filtered folder. + if not globals.options.singlethreading: thread = InstanceLimitedThread( limitNamespace = "%s%s"% ( @@ -406,6 +420,7 @@ class SyncableAccount(Account): except Exception as e: self.ui.error(e, exc_info()[2], msg="Calling hook") + def syncfolder(account, remotefolder, quick): """Synchronizes given remote folder for the specified account.