fix: do not trash pre-message if it is received twice

This commit is contained in:
link2xt
2026-02-27 20:13:05 +00:00
committed by l
parent c724e2981c
commit a6c7958739
2 changed files with 50 additions and 4 deletions

View File

@@ -539,9 +539,17 @@ pub(crate) async fn receive_imf_inner(
.await?
.filter(|msg| msg.download_state() != DownloadState::Done)
{
// the message was partially downloaded before and is fully downloaded now.
info!(context, "Message already partly in DB, replacing.");
Some(msg.chat_id)
// The message was partially downloaded before.
match mime_parser.pre_message {
PreMessageMode::Post | PreMessageMode::None => {
info!(context, "Message already partly in DB, replacing.");
Some(msg.chat_id)
}
PreMessageMode::Pre { .. } => {
info!(context, "Cannot replace pre-message with a pre-message");
None
}
}
} else {
// The message was already fully downloaded
// or cannot be loaded because it is deleted.