GODT-1817: Restore old date message feature test + fix

This patch also fixes the message builder to not override other headers
that already exist to avoid overriding sanitized header entries.
This commit is contained in:
Leander Beernaert
2023-01-03 15:29:29 +01:00
parent 6e7f374b0d
commit 272e3895fd
7 changed files with 72 additions and 5 deletions

View File

@ -364,7 +364,10 @@ func writeMultipartEncryptedRFC822(header message.Header, body []byte) ([]byte,
entFields := bodyHeader.Fields()
for entFields.Next() {
header.Set(entFields.Key(), entFields.Value())
// Only set the header field if it is present. Header sanitation will be overridden otherwise.
if !header.Has(entFields.Key()) {
header.Set(entFields.Key(), entFields.Value())
}
}
if err := textproto.WriteHeader(buf, header.Header); err != nil {