diff options
author | Koni Marti <koni.marti@gmail.com> | 2022-04-07 23:05:32 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-04-11 12:06:53 +0200 |
commit | f6e34e4cf16d2506d865adb35a650c383b8dc6fd (patch) | |
tree | 7ff694c9af57706461c6fa1237e87fe756592dd3 /lib/msgstore.go | |
parent | e810ae12d7b86dfe51aed6f5b88e90c1fe1814ac (diff) | |
download | aerc-f6e34e4cf16d2506d865adb35a650c383b8dc6fd.tar.gz |
imap: fix no-envelope-for-message error
Fix the "no envelope available for this message" error that can occur
when using the same imap mailbox in another mailclient (e.g.
through a webmail interface) at the same time.
Complements the fixes in commit 7fe7fe4 ("ui: fix panic in header
formatter") and commit 074b0a1 ("view,list: fix crash when viewing
incomplete imap messages").
The error is caused when a message attribute update is received by the
message store before the message list had a chance to fetch the proper
header first. In this case, an (incomplete) message info is stored in
the message store and the message list will never fetch the correct
header. To prevent this, add only messages to the store with a non-nil
envelope but make sure that message attribute updates are properly
merged.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/msgstore.go')
-rw-r--r-- | lib/msgstore.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go index a29aad4f..bd8d54d5 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -225,7 +225,9 @@ func (store *MessageStore) Update(msg types.WorkerMessage) { if existing, ok := store.Messages[msg.Info.Uid]; ok && existing != nil { merge(existing, msg.Info) } else { - store.Messages[msg.Info.Uid] = msg.Info + if msg.Info.Envelope != nil { + store.Messages[msg.Info.Uid] = msg.Info + } } seen := false recent := false |