After queueing a message in the web api's, prevent context cancelation from completing message changes

Adding to the queue is done in a transaction, the queue db file is mox-global.
Appending the message to the Sent folder, removing it from Drafts, marking the
original message as answered/forwarded, is done in a separate database
transaction that gets the ctx passed in. If the ctx was canceled in between,
the queueing was finished, but the rest wasn't completed.

Reported by mteege, thanks!
This commit is contained in:
Mechiel Lukkien
2025-03-23 11:07:39 +01:00
parent b0e4dcdb61
commit b37faa06bd
2 changed files with 7 additions and 0 deletions

View File

@ -1005,6 +1005,10 @@ func (w Webmail) MessageSubmit(ctx context.Context, m SubmitMessage) {
var modseq store.ModSeq // Only set if needed.
// We have committed to sending the message. We want to follow through
// with appending to Sent and removing the draft message.
ctx = context.WithoutCancel(ctx)
// Append message to Sent mailbox, mark original messages as answered/forwarded,
// remove any draft message.
acc.WithWLock(func() {