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 <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-06-26 19:14:04 +02:00
parent 268adb782f
commit 6b28071b0f

View File

@ -347,11 +347,25 @@ class SyncableAccount(Account):
self.ui.debug('', "Not syncing filtered folder '%s'" self.ui.debug('', "Not syncing filtered folder '%s'"
"[%s]"% (remotefolder, remoterepos)) "[%s]"% (remotefolder, remoterepos))
continue # Ignore filtered folder. 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) localfolder = self.get_local_folder(remotefolder)
if not localfolder.sync_this: if not localfolder.sync_this:
self.ui.debug('', "Not syncing filtered folder '%s'" self.ui.debug('', "Not syncing filtered folder '%s'"
"[%s]"% (localfolder, localfolder.repository)) "[%s]"% (localfolder, localfolder.repository))
continue # Ignore filtered folder. continue # Ignore filtered folder.
if not globals.options.singlethreading: if not globals.options.singlethreading:
thread = InstanceLimitedThread( thread = InstanceLimitedThread(
limitNamespace = "%s%s"% ( limitNamespace = "%s%s"% (
@ -406,6 +420,7 @@ class SyncableAccount(Account):
except Exception as e: except Exception as e:
self.ui.error(e, exc_info()[2], msg="Calling hook") self.ui.error(e, exc_info()[2], msg="Calling hook")
def syncfolder(account, remotefolder, quick): def syncfolder(account, remotefolder, quick):
"""Synchronizes given remote folder for the specified account. """Synchronizes given remote folder for the specified account.