-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling (escaped) slashes in folder name #208
Comments
Hi, Can you try with imapmirror (https://github.com/IMAPMirror/imapmirror)? It's better at encoding. |
I don't know if imapmirror would sync correct on this. But i know "\/" is not allowed in imap4 quoted strings, and there is no way to escape the mailbox separator. The part trying to "neutralise" any slash if "/" is mailbox separator is at fault (and it is not imaplib2). |
Dear @mmauger I created a folder (web interface). I synced without problems:
I moved a mail inside de the folder (using local email client). Then sync:
The folder in the filesystem is Can you try without Regards, |
I'm sync'ing my Protonmail email thru the Protonmail Bridge which provides encrypted connections back to my Proton Mail account. Connectivity is successfully established and emails are downloaded properly.
However I have several folders in Proton that contain the slash character (
/
) which Proton permits and transmits with the folder name with slashes escaped by a backslash (\
) as I'd expect. Butofflineimap
is not handling the escaped slashes explicitly so I end up with nested folders with parent folders ending in a backslash. That is, the folder "FSF / GNU / EFF
" gets sent as "FSF \/ GNU \/ EFF
" and gets created as nested directories in the Maildir tree: (EFF
folder within anGNU \
folder, within anFSF \
folder). I tried to combat this somewhat with anametrans
rule to transform the\/
sequence in the folder name with a Unicode diamond character (♢
). This fixes the Maildir folder creation but fails later when it sends the Maildir folder name back to the IMAP server rather than the IMAP name.So, I think there are two issues here, but will leave it to others to properly debug and identify the source:
And as a bonus issue, which I do not believe is yours, but in
imaplib2
. The "SELECT command error"appears to be a SQL injection issue in that the escaped string is being interpreted by the command processor, rather than just being passed as data. I'll defer to others' judgement if this is what is happening and whether an issue needs to be raised with that project.
Please feel free to reach out if you want additional debug information or if you'd like me to try another solution. (I'm a senior Emacs, SQL, Python dev, so I can provide some assistance; I did try to dig in a little, but the learning curve was significant with other responsibilities...)
General informations
offlineimap -V
):offlineimap v8.0.0, imaplib2 v3.06, Python v3.12.6, OpenSSL 3.2.2 4 Jun 2024
Python 3.12.6
Configuration file offlineimaprc
Validated with
--info
and--dry-run
optionsLogs, error
Steps to reproduce the error
offlineimap
to capture my Protonmail emails.The text was updated successfully, but these errors were encountered: