`download_msg` should fail to download full message if UIDVALIDITY has changed
- Dominant language
- Rust
- Stars
- 929
- Forks
- 143
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 53
Description
When the user has requested full download of a partially downloaded message, `download_msg` looks up the folder and UID of the message in `imap` table:
https://github.com/chatmail/core/blob/51b9e86d71fe1e80bb0935c1c3bb711555ec36d5/src/download.rs#L160
`imap` table also stores UID validity. If UID validity of the folder has changed since the time the message was partially downloaded, then `imap` entry becomes invalid. To avoid attempting to download unrelated message with different uidvalidity and the same UID, `download_msg` should check again after calling `select_with_uidvalidity` that selected folder has the same uidvalidity as the database entry. The folder should not be unselected until the message is downloaded and passed to `receive_imf`.
Moving the discussion out of https://github.com/chatmail/core/pull/6877#discussion_r2160511811 because this bug was always there, not introduced in https://github.com/chatmail/core/pull/6877
It is also very unlikely that this happens in practice, so this issue is very low priority. If this is fixed there definitely has to be an online test deleting and recreating a folder to change uid validity because there is no chance regressions will be noticed otherwise.
Contributor guide
Assessment
This issue has not been assessed yet.