Don't allow mailboxes named "." or ".." and normalize names during imports too

It only serves to confuse. When exporting such mailboxes in zip files or tar
files, extracting will cause trouble.
This commit is contained in:
Mechiel Lukkien
2025-03-05 22:28:25 +01:00
parent 7872b138a5
commit e572d01341
4 changed files with 36 additions and 10 deletions

View File

@ -433,10 +433,10 @@ func importMessages(ctx context.Context, log mlog.Log, token string, acc *store.
}
xensureMailbox := func(name string) *store.Mailbox {
// Ensure name is normalized.
name = norm.NFC.String(name)
if strings.ToLower(name) == "inbox" {
name = "Inbox"
}
name, _, err := store.CheckMailboxName(name, true)
ximportcheckf(err, "checking mailbox name")
if mb, ok := mailboxNames[name]; ok {
return mb