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 --- models/models.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'models/models.go') diff --git a/models/models.go b/models/models.go index ac2e170a..c6315e0e 100644 --- a/models/models.go +++ b/models/models.go @@ -7,6 +7,7 @@ import ( "strings" "time" + "git.sr.ht/~rjarry/aerc/lib/parse" "github.com/emersion/go-message/mail" ) @@ -101,10 +102,7 @@ func (mi *MessageInfo) InReplyTo() (msgid string, err error) { if mi.RFC822Headers == nil { return "", errors.New("header is nil") } - list, err := mi.RFC822Headers.MsgIDList("In-Reply-To") - if err != nil { - return "", err - } + list := parse.MsgIDList(mi.RFC822Headers, "In-Reply-To") if len(list) == 0 { return "", errors.New("no results") } @@ -121,14 +119,11 @@ func (mi *MessageInfo) References() ([]string, error) { if mi.RFC822Headers == nil { return []string{}, errors.New("header is nil") } - list, err := mi.RFC822Headers.MsgIDList("References") - if err != nil { - return []string{}, err - } + list := parse.MsgIDList(mi.RFC822Headers, "References") if len(list) == 0 { return []string{}, errors.New("no results") } - return list, err + return list, nil } // A MessageBodyPart can be displayed in the message viewer -- cgit