diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2023-03-11 13:26:58 +0900 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-03-26 21:02:18 +0200 |
commit | 94a763920f5ee8b54b8ba7f819be373d80a4805d (patch) | |
tree | ccff19f3bb7c35dc02af49f04fe6adfce251498f /commands | |
parent | c09b17a930cc58c13dd5dd2ba8e7a261833eb05a (diff) | |
download | aerc-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 'commands')
-rw-r--r-- | commands/msg/reply.go | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/commands/msg/reply.go b/commands/msg/reply.go index 8a244fed..4fb5860a 100644 --- a/commands/msg/reply.go +++ b/commands/msg/reply.go @@ -16,6 +16,7 @@ import ( "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/lib/crypto" "git.sr.ht/~rjarry/aerc/lib/format" + "git.sr.ht/~rjarry/aerc/lib/parse" "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/widgets" @@ -299,17 +300,11 @@ func (s addrSet) Contains(a *mail.Address) bool { // setReferencesHeader adds the references header to target based on parent // according to RFC2822 func setReferencesHeader(target, parent *mail.Header) error { - refs, err := parent.MsgIDList("references") - if err != nil { - return err - } + refs := parse.MsgIDList(parent, "references") if len(refs) == 0 { // according to the RFC we need to fall back to in-reply-to only if // References is not set - refs, err = parent.MsgIDList("in-reply-to") - if err != nil { - return err - } + refs = parse.MsgIDList(parent, "in-reply-to") } msgID, err := parent.MessageID() if err != nil { |