fix: set contentID if present and not explicitly attachment

This commit is contained in:
James Houlahan
2021-01-28 14:53:08 +01:00
committed by Jakub
parent 0c458f709f
commit 4ffa62f6ca
2 changed files with 12 additions and 1 deletions

View File

@ -528,7 +528,17 @@ func parseAttachment(h message.Header) (*pmapi.Attachment, error) {
// 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" {
// If Content-Disposition is present, we base our decision on that.
// Otherwise, if Content-Disposition is missing but there is a ContentID, set it.
// (This is necessary because some clients don't set Content-Disposition at all,
// so we need to rely on other information to deduce if it's inline or attachment.)
if h.Has("Content-Disposition") {
if disp, _, err := h.ContentDisposition(); err != nil {
return nil, err
} else if disp == "inline" {
att.ContentID = strings.Trim(h.Get("Content-Id"), " <>")
}
} else if h.Has("Content-Id") {
att.ContentID = strings.Trim(h.Get("Content-Id"), " <>")
}

View File

@ -13,3 +13,4 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
### Fixed
* GODT-787 GODT-978 Fix IE and Bridge importing to sent not showing up in inbox (setting up flags properly).
* GODT-1006 Use correct macOS keychain name.
* GODT-1009 Set ContentID if present and not explicitly attachment.