Saving or discarding a draft can delete an unrelated message in the folder it was saved to
Categories
(MailNews Core :: Composition, defect)
Tracking
(Not tracked)
People
(Reporter: welpy-cw, Assigned: welpy-cw)
References
(Blocks 1 open bug)
Details
Attachments
(2 external files)
When an edited draft or template is saved, or an autosaved draft is discarded, the previous version is removed. Two code paths do this by taking the message key from the previous version's URI and deleting the message with that key in the folder the new version was saved to:
- the IMAP fallback in
nsMsgComposeSendListener::RemoveDraftOrTemplate(), used when the previous version's header isn't in the local database RemoveDraft()inMsgComposeCommands.js
If the previous version was in a different folder (for example a draft opened from a subfolder of Drafts, or a template being edited while the autosave goes to Drafts), the same key can belong to an unrelated message in the target folder, and that message gets deleted.
Fix: only delete when the previous version's URI is the target folder's URI for that key.
RemoveDraft() also has an IMAP fallback that passes the non-existent nsMsgFolderFlags.Expunged as IMAP flags, so it has stored no flags since bug 453908. It can be removed.
| Assignee | ||
Comment 1•4 days ago
|
||
Both RemoveDraftOrTemplate()'s IMAP fallback and RemoveDraft() took the
message key from the previous version's URI, but deleted the message with
that key in the folder the new version was saved to. If the previous version
was in another folder, the same key could belong to an unrelated message.
Only delete when the previous version's URI is that folder's URI for the key.
Also remove RemoveDraft()'s IMAP fallback. It passed the non-existent
nsMsgFolderFlags.Expunged as IMAP flags, so it has stored no flags since
bug 453908.
| Assignee | ||
Comment 2•1 day ago
|
||
RFC 3501 requires the UID in any FETCH response caused by a UID command, but
the fake server's STORE handler left it out. Without the UID, the protocol
didn't record the flags of a message it hadn't fetched yet, so marking such a
message deleted triggered the "deleted msg not found in flagState" assertion
on Debug builds.
| Assignee | ||
Updated•19 hours ago
|
Pushed by toby@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/d58980e4eee6
Include the UID in the fake IMAP server's responses to UID STORE. r=BenC
https://hg.mozilla.org/comm-central/rev/db3d896f33ae
Don't delete an unrelated message using a draft's key from another folder. r=mkmelin
Description
•