offlineimap icon indicating copy to clipboard operation
offlineimap copied to clipboard

Folder names including forward slash cause ERROR: getfolder() asked for a nonexisting folder

Open JonathanH-UK opened this issue 4 years ago • 1 comments

General informations

  • system/distribution (with version): Ubuntu 20.04
  • offlineimap version (offlineimap -V): offlineimap v7.1.1, imaplib2 v2.57 (system), Python v2.7.18, OpenSSL 1.1.1f 31 Mar 2020
  • Python version: Python v2.7.18
  • server name or domain: mail.livemail.co.uk
  • CLI options: -1

Configuration file offlineimaprc

[general]
accounts = XYZ

[Account XYZ]
localrepository = XYZLocal
remoterepository = XYZRemote

[Repository XYZLocal]
type = Maildir
localfolders = ~/Email/XYZ_Backup

[Repository XYZRemote]
type = IMAP
remotehost = mail.livemail.co.uk
remoteuser = info@#####.org.uk
sslcacertfile = OS-DEFAULT

pythonfile (if any)

N/A

Logs, error

 Syncing Brokerage~Jane Doe : IMAP -> Maildir
 ERROR: getfolder() asked for a nonexisting folder 'Brokerage.John Doe/BREAKME'.
 *** Finished account 'XYZ' in 0:08
 ERROR: Exceptions occurred during the run!
 ERROR: getfolder() asked for a nonexisting folder 'Brokerage.John Doe/BREAKME'.
 
Traceback:
  File "/home/jonathan/Source_Code/offlineimap/offlineimap/accounts.py", line 281, in syncrunner
    self.__sync()
  File "/home/jonathan/Source_Code/offlineimap/offlineimap/accounts.py", line 378, in __sync
    localfolder = self.get_local_folder(remotefolder)
  File "/home/jonathan/Source_Code/offlineimap/offlineimap/accounts.py", line 310, in get_local_folder
    replace(self.remoterepos.getsep(), self.localrepos.getsep()))
  File "/home/jonathan/Source_Code/offlineimap/offlineimap/repository/Maildir.py", line 149, in getfolder
    "folder '%s'."% foldername, OfflineImapError.ERROR.FOLDER)

Steps to reproduce the error

  • Create a mail subfolder - e.g. Brokerage and then a folder under that such as 'Something/Else'
  • Try to sync this IMAP account using offlineimap
  • Under the backup directory the folders get created as
BackupDir
 |_ Brokerage.Something
   |_ Else
  • When the sync takes place it is looking for a correctly escaped directory name called exacty Brokerage.Something/Else which does not exist.
  • offlineimapsync Crashes and Burns :-(

Workaround

  • Rename IMAP folder so it doesn't contain a slash in the name

JonathanH-UK avatar Sep 30 '21 22:09 JonathanH-UK

I wonder the server is not providing the correct separator character.

Sadly, --info does not give info about this. This might worth adding this.

nicolas33 avatar Oct 30 '21 22:10 nicolas33