message: when parsing a message, don't treat absent header and empty header value the same

We now use "*string" for such header fields, for Content-* fields, as used in
the imapserver when responding to FETCH commands. We'll now return NIL for an
absent header, and "" (empty string) if the header value is empty.
This commit is contained in:
Mechiel Lukkien
2025-04-16 13:04:55 +02:00
parent 3fe765dce9
commit 07533252b3
12 changed files with 96 additions and 59 deletions

View File

@ -929,10 +929,14 @@ func PartStructure(log mlog.Log, p *message.Part) (webhook.Structure, error) {
} else if err != nil {
return webhook.Structure{}, err
}
var cid string
if p.ContentID != nil {
cid = *p.ContentID
}
s := webhook.Structure{
ContentType: strings.ToLower(p.MediaType + "/" + p.MediaSubType),
ContentTypeParams: p.ContentTypeParams,
ContentID: p.ContentID,
ContentID: cid,
ContentDisposition: strings.ToLower(disp),
Filename: filename,
DecodedSize: p.DecodedSize,