fix(GODT-3087): Exclude attachment content-disposition part when determining...

This commit is contained in:
Romain Le Jeune
2023-11-03 08:55:01 +00:00
parent 96773f3225
commit 1c385d5c9b
7 changed files with 321 additions and 8 deletions

View File

@ -54,7 +54,7 @@ func (p *Part) ContentType() (string, map[string]string, error) {
}
func (p *Part) ContentDisposition() (string, map[string]string, error) {
return p.Header.ContentDisposition()
return pmmime.ParseMediaType(p.Header.Get("Content-Disposition"))
}
func (p *Part) HasContentID() bool {
@ -209,6 +209,14 @@ func (p *Part) isMultipartMixedOrRelated() bool {
return t == "multipart/mixed" || t == "multipart/related"
}
func (p *Part) isAttachment() bool {
disp, _, err := p.ContentDisposition()
if err != nil {
disp = ""
}
return disp == "attachment"
}
func getContentHeaders(header message.Header) message.Header {
var res message.Header