aboutsummaryrefslogtreecommitdiffstats
path: root/worker/lib/parse.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-11-11 22:36:42 +0100
committerRobin Jarry <robin@jarry.cc>2022-11-13 17:14:04 +0100
commit1352942056940afb58d4e25d8094c08251fd54de (patch)
treef322430d5bd8e947dd12f70ee3037ad71ca727c4 /worker/lib/parse.go
parent775f5791257b141cea2dfec45e6f6c7ca145509e (diff)
downloadaerc-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/parse.go')
-rw-r--r--worker/lib/parse.go11
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)