chatmail / chatmail/core

`download_msg` should fail to download full message if UIDVALIDITY has changed

Open
#7,330 4 comments 0 reactions 0 assignees View on GitHub
bug
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.