deltachat-core-rust icon indicating copy to clipboard operation
deltachat-core-rust copied to clipboard

feat: protect the Date header

Open link2xt opened this issue 6 months ago • 3 comments

Closes #6878 Based on #6867 This depends an a fix #6669, so we may want to postpone merging this until more users have it.

We do not try to delete resent messages anymore. Previously resent messages were distinguised by having duplicate Message-ID, but future Date, but now we need to download the message before we even see the Date. We now move the message to the destination folder but do not fetch it.

It may not be a good idea to delete the duplicate in multi-device setups anyway, because the device which has a message may delete the duplicate of a message the other device missed.

To avoid triggering IMAP move loop described in the comments we now only move the messages from INBOX and Spam folders.

link2xt avatar May 28 '25 05:05 link2xt

Legacy Python test tests/test_1_online.py::test_resend_message got broken by this. Resent message is not recognized as duplicate anymore because outer timestamp of just received message is compared to the timestamp of the fetched message: https://github.com/chatmail/core/blob/adcc8a919cc5f5428cba0c49957fdd0651635b1b/src/imap.rs#L603-L610

link2xt avatar May 28 '25 05:05 link2xt

This has now broken the test added in c14f45a8f5523c14c2b567c745dd5980387c5207

link2xt avatar May 28 '25 08:05 link2xt

We will have to use something less suspicious than unix epoch, GMX is unhappy: https://github.com/chatmail/core/issues/6878#issuecomment-2923262681

link2xt avatar May 30 '25 19:05 link2xt

I have updated this PR to not send 1970 as the date. Should be good enough for review/merging now.

link2xt avatar Jun 22 '25 14:06 link2xt

So now the date looks like this Date: Sun, 15 Jun 2025 15:06:40 +0000. You convert it and get:

date -d 'Sun, 15 Jun 2025 15:06:40 +0000' +%s
1750000000

link2xt avatar Jun 22 '25 17:06 link2xt

@link2xt can we merge this, or is there a specific reason why you didn't merge it yet?

Hocuri avatar Oct 23 '25 14:10 Hocuri