Open the-djmaze opened 1 week ago
I don't think that a MAILBOXID (uniqueid) should ever contain non-ASCII chars. @brong can you think of any way that this could happen, outside of corruption?
BTW, this was on a test server with cyrus-imapd-3.4.1 as shipped with RHEL9. Mail spool was from a 2.4 server, I ran reconstruct and reconstruct -V max and it seemed to be fine. The server then worked without issues in my tests. Could it be that there was a bug in 3.4.1 which was fixed since then?
There's a bug in OBJECTID RFC 8474 implementation that returns invalid characters in the MAILBOXID.
See https://github.com/the-djmaze/snappymail/issues/1640#issuecomment-2186796033
Issue is at https://github.com/cyrusimap/cyrus-imapd/blob/748cfafef811038e79a8fdc9fd1bb66b6afb4492/imap/imapd.c#L9638
Probably caused by https://github.com/cyrusimap/cyrus-imapd/blob/748cfafef811038e79a8fdc9fd1bb66b6afb4492/imap/mailbox.c#L1130-L1135
JMAP mailboxIds doesn't seem to be affected as they are encoded there.
So maybe use something like
or something like
Better approach would be to make
uniqueid
not binary, because then there's no need for conversions at runtime all the time. But that would probably be a big change?