Bug: move by filter results in empty message when loading previously partly message - causing loss of message!
Status: UNCONFIRMED
Priority: --
Created: 2022-11-09 19:40:47+00:00
Resolved: 2022-11-11 07:48:54+00:00

Steps to reproduce:

Precondition:
Thunderbird Version 102.4.2 64-Bit on Windows-10
Setup a new account for a pop3 mail server.
Server-Settings:
[x] Check for new messages at statup
[x] Automatically download new messages
[x] Fetch headers only
[x] Leave messages on server
   [x] until I delete them

In the Inbox one additonal folder exists:
-Inbox
  -myfolder

Additonally there is a filter configured with following parameters (msgFilterRules.dat):
version="9"
logging="yes"
name="nomail"
enabled="yes"
type="17"
action="Move to folder"
actionValue="mailbox://testmail%40mydomain.org@mail.mydomain.org/Inbox/myfolder"
condition="AND (from,contains,nomail.com)"

Performed action
Send an email having foo@nomail.com as sender to this pop3 mail account. Lets say this mail gets the UIDL "12345678.mydomain.org" when reding via pop3 protocol.

On thunderbird Click "Get Messages"

Reaction:
the header of the mail with UIDL "12345678.mydomain.org" is fetch from the server and automatically moved to folder "myfolder".

in the mbox file of myfolder the mail headers of this mail are strored and the mail has the X-Mozilla-Status: 0400 (MSG_FLAG_PARTIAL)

In the popstate.dat file the uidl is listed as
b 12345678.mydomain.org
=> mail is incomplete

So far everything is as expected!

Next step:
Select the just received mail. The mail Headers are shown and the mail body shows "Not Doesnloaded [...]"
Click on "Download the rest of the message"





Actual results:

Thunderbits fetches the complete mail from the server (as could be seen by tracing the network traffic of the pop3 communication)
The mail is still selected but the Mail is shown completely emtpy. No Headers no body. Just a blank white space where notmally the messge is. A double click on the message Opens a new tab having the subject of the mail in its tile but is completely empty.

The mbox file Still only contains the headers of the mail, but no additonally downlaoded data. Just the X-Mozilla-Status has changed to 0401 (MSG_FLAG_PARTIAL | MSG_FLAG_READ)

In the popstate.dat file the uidl is listed as
k 12345678.mydomain.org
=> mail is incomplete


This issue only happens in case the filter as decribed above is active. If there is no filter (e.g. delete msgFilterRules.dat) the mail is correctly downloaded.

This issue is 100% reproducable with the described setup above.
For me it looks as the filter handling conflicts with the downloading the rest of the file.

Also the msf file looks corrupted, as not even the header data are shown.
After repairing the folder (Folder Properties-> Repair Folder) at lease the headers are shown again, but as the mail is already marked a "full-keep on server" it will not fetched any more from the server.

In case the pop3 Account is configured without "Leave messages on server" Thunderbird sends a "DELE" command after fetching the mail. This causes that the mail is delete on the server and therefore has been completely lost as it was not written to the mbox file.



Expected results:

The complete mail should have been downloaded and stored in the mbox file of "myfolder"