view: ensure envelope headers are always populated

Some email backends return Envelopes with only the basic headers filled
in. But that might clash with a user's configurations which operates on
specific headers when viewing an email. So, when having loaded an email
completely, make sure its envelope's headers is completely populated
before presenting it to the user.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
This commit is contained in:
Manos Pitsidianakis 2024-11-29 23:27:20 +02:00
parent 1f2fec198f
commit fcab855fda
No known key found for this signature in database
GPG key ID: 7729C7707F7E09D0

View file

@ -96,17 +96,12 @@ impl MailViewState {
return;
};
let account = &mut context.accounts[&coordinates.0];
if account
// Ensure all envelope headers are populated, because the email backend might
// have not populated them all.
_ = account
.collection
.get_env(coordinates.2)
.other_headers()
.is_empty()
{
let _ = account
.collection
.get_env_mut(coordinates.2)
.populate_headers(&bytes);
}
.get_env_mut(coordinates.2)
.populate_headers(&bytes);
let env = Box::new(account.collection.get_env(coordinates.2).clone());
let env_view = Box::new(EnvelopeView::new(
Mail {