From 94a763920f5ee8b54b8ba7f819be373d80a4805d Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Sat, 11 Mar 2023 13:26:58 +0900 Subject: parse msg-id lists more liberally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some user agents deliberately generate non-standard message identifier lists in In-Reply-To and References headers. Instead of failing silently, aerc now falls back to a desperate parser scavaging whatever looking like . As the more liberal parser being substituted with, References header are now stored for IMAP not only when there's a parsing error. Fixes: 31d2f5be3cec ("message-info: add explicit References field") Signed-off-by: Nguyễn Gia Phong Acked-by: Robin Jarry --- worker/imap/fetch.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'worker/imap/fetch.go') diff --git a/worker/imap/fetch.go b/worker/imap/fetch.go index 62451308..a8245784 100644 --- a/worker/imap/fetch.go +++ b/worker/imap/fetch.go @@ -10,6 +10,7 @@ import ( "github.com/emersion/go-message/mail" "github.com/emersion/go-message/textproto" + "git.sr.ht/~rjarry/aerc/lib/parse" "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" @@ -64,12 +65,9 @@ func (imapw *IMAPWorker) handleFetchMessageHeaders( Flags: translateImapFlags(_msg.Flags), InternalDate: _msg.InternalDate, RFC822Headers: header, + Refs: parse.MsgIDList(header, "references"), Uid: _msg.Uid, } - refs, err := header.MsgIDList("references") - if err != nil { - info.Refs = refs - } imapw.worker.PostMessage(&types.MessageInfo{ Message: types.RespondTo(msg), Info: info, -- cgit