mirror of
https://github.com/mjl-/mox.git
synced 2025-07-13 14:54:35 +03:00
Before moving message files in imapserver and webmail API, ensure the message destination directory for the newly assigned IDs exist.
Example symptom, when deleting a message in the webmail (which moves to Trash): l=error m="duplicating message in old mailbox for current sessions" err="link data/accounts/mjl/msg/I/368638 data/accounts/mjl/msg/J/368640: no such file or directory" pkg=webmail Problem introduced a few weeks ago, where moving messages starting duplicating the message first, and the copy is erased once all references (in IMAP sessions) to the old mailbox have been removed.
This commit is contained in:
@ -394,7 +394,7 @@ func TestNextMessageID(t *testing.T) {
|
||||
acc, err = OpenAccount(log, "mjl", false)
|
||||
tcheck(t, err, "open account")
|
||||
|
||||
// Deliver a message. It should get ID 8*1024+1.
|
||||
// Deliver a message. It should get ID $msgFilesPerDir+1.
|
||||
mf, err = CreateMessageTemp(log, "account-test")
|
||||
tcheck(t, err, "creating temp message file")
|
||||
_, err = mf.Write(msgData)
|
||||
@ -405,8 +405,8 @@ func TestNextMessageID(t *testing.T) {
|
||||
}
|
||||
err = acc.DeliverMailbox(log, "Inbox", &m, mf)
|
||||
tcheck(t, err, "deliver mailbox")
|
||||
if m.ID != 8*1024+1 {
|
||||
t.Fatalf("got message id %d, expected 8*1024+1", m.ID)
|
||||
if m.ID != msgFilesPerDir+1 {
|
||||
t.Fatalf("got message id %d, expected $msgFilesPerDir+1", m.ID)
|
||||
}
|
||||
|
||||
err = acc.Close()
|
||||
|
Reference in New Issue
Block a user