GODT-2142: Also permit split by comma in References header

This commit is contained in:
James Houlahan
2022-11-22 19:08:03 +01:00
parent cb81175fa0
commit 555453bc1a
4 changed files with 51 additions and 8 deletions

View File

@ -30,7 +30,6 @@ import (
"github.com/ProtonMail/go-rfc5322"
"github.com/ProtonMail/proton-bridge/v2/pkg/message/parser"
pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime"
"github.com/bradenaw/juniper/xslices"
"github.com/emersion/go-message"
"github.com/jaytaylor/html2text"
"github.com/pkg/errors"
@ -497,9 +496,11 @@ func parseMessageHeader(h message.Header) (Message, error) { //nolint:funlen
m.InReplyTo = regexp.MustCompile("<(.*)>").ReplaceAllString(fields.Value(), "$1")
case "references":
m.References = append(m.References, xslices.Map(strings.Fields(fields.Value()), func(ref string) string {
return strings.Trim(ref, "<>")
})...)
for _, ref := range strings.Fields(fields.Value()) {
for _, ref := range strings.Split(ref, ",") {
m.References = append(m.References, strings.Trim(ref, "<>"))
}
}
}
}