diff options
author | Koni Marti <koni.marti@gmail.com> | 2022-11-11 22:36:42 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-11-13 17:14:04 +0100 |
commit | 1352942056940afb58d4e25d8094c08251fd54de (patch) | |
tree | f322430d5bd8e947dd12f70ee3037ad71ca727c4 /worker/lib | |
parent | 775f5791257b141cea2dfec45e6f6c7ca145509e (diff) | |
download | aerc-1352942056940afb58d4e25d8094c08251fd54de.tar.gz |
maildir: fallback when parsing for in-reply-to fails
Fallback to just using the raw In-Reply-To header content when it cannot
be properly parsed as a message-id.
Fixes: ca903d422826 ("envelope: add InReplyTo field")
Reported-by: Bence Ferdinandy <bence@ferdinandy.com>
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Diffstat (limited to 'worker/lib')
-rw-r--r-- | worker/lib/parse.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/worker/lib/parse.go b/worker/lib/parse.go index 7e1f36f2..8c1be2a9 100644 --- a/worker/lib/parse.go +++ b/worker/lib/parse.go @@ -164,12 +164,15 @@ func parseEnvelope(h *mail.Header) (*models.Envelope, error) { return nil, err } } + var irt string irtList, err := h.MsgIDList("in-reply-to") if err != nil { - return nil, err - } - irt := "" - if len(irtList) > 0 { + // proper parsing failed, so fall back to whatever is there + irt, err = h.Text("in-reply-to") + if err != nil { + return nil, err + } + } else if len(irtList) > 0 { irt = irtList[0] } date, err := parseDate(h) |