mirror of
https://github.com/mjl-/mox.git
synced 2025-07-19 00:06:37 +03:00
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:
@ -16,6 +16,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"golang.org/x/text/unicode/norm"
|
||||
|
||||
"github.com/mjl-/mox/config"
|
||||
"github.com/mjl-/mox/message"
|
||||
"github.com/mjl-/mox/metrics"
|
||||
@ -189,6 +191,11 @@ func importctl(ctx context.Context, ctl *ctl, mbox bool) {
|
||||
var mdnewf, mdcurf *os.File
|
||||
var msgreader store.MsgSource
|
||||
|
||||
// Ensure normalized form.
|
||||
mailbox = norm.NFC.String(mailbox)
|
||||
mailbox, _, err = store.CheckMailboxName(mailbox, true)
|
||||
ctl.xcheck(err, "checking mailbox name")
|
||||
|
||||
// Open account, creating a database file if it doesn't exist yet. It must be known
|
||||
// in the configuration file.
|
||||
a, err := store.OpenAccount(ctl.log, account, false)
|
||||
|
Reference in New Issue
Block a user