aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2023-03-11 13:26:58 +0900
committerRobin Jarry <robin@jarry.cc>2023-03-26 21:02:18 +0200
commit94a763920f5ee8b54b8ba7f819be373d80a4805d (patch)
treeccff19f3bb7c35dc02af49f04fe6adfce251498f /models
parentc09b17a930cc58c13dd5dd2ba8e7a261833eb05a (diff)
downloadaerc-94a763920f5ee8b54b8ba7f819be373d80a4805d.tar.gz
parse msg-id lists more liberally
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 <id-left@id-right>. 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 <mcsinyx@disroot.org> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'models')
-rw-r--r--models/models.go13
1 files changed, 4 insertions, 9 deletions
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