fix: only set ContentID for inline attachments

This commit is contained in:
James Houlahan
2020-12-09 15:08:48 +01:00
parent 363f553d3c
commit 25c1014ab0
2 changed files with 6 additions and 1 deletions

View File

@ -510,7 +510,11 @@ func parseAttachment(h message.Header) (*pmapi.Attachment, error) {
}
}
att.ContentID = strings.Trim(h.Get("Content-Id"), " <>")
// Only set ContentID if it should be inline;
// API infers content disposition based on whether ContentID is present.
if disp, _, err := h.ContentDisposition(); err == nil && disp == "inline" {
att.ContentID = strings.Trim(h.Get("Content-Id"), " <>")
}
return att, nil
}

View File

@ -21,3 +21,4 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
### Changed
* GODT-389 Prefer `From` header instead of `MAIL FROM` address.
* GODT-898 Only set ContentID for inline attachments.