forked from Silverfish/proton-bridge
fix(GODT-2851): Add empty text part if no text part when importing multipart.
This commit is contained in:
@ -84,7 +84,7 @@ func (p *Parser) AttachPublicKey(key, keyName string) {
|
||||
})
|
||||
}
|
||||
|
||||
func (p *Parser) AttachEmptyTextPartIfNoneExists() {
|
||||
func (p *Parser) AttachEmptyTextPartIfNoneExists() bool {
|
||||
root := p.Root()
|
||||
if root.isMultipartMixed() {
|
||||
for _, v := range root.children {
|
||||
@ -95,14 +95,14 @@ func (p *Parser) AttachEmptyTextPartIfNoneExists() {
|
||||
contentType, _, err := v.Header.ContentType()
|
||||
if err == nil && strings.HasPrefix(contentType, "text/") {
|
||||
// Message already has text part
|
||||
return
|
||||
return false
|
||||
}
|
||||
}
|
||||
} else {
|
||||
contentType, _, err := root.Header.ContentType()
|
||||
if err == nil && strings.HasPrefix(contentType, "text/") {
|
||||
// Message already has text part
|
||||
return
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,6 +115,7 @@ func (p *Parser) AttachEmptyTextPartIfNoneExists() {
|
||||
Header: h,
|
||||
Body: nil,
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
// Section returns the message part referred to by the given section. A section
|
||||
|
||||
Reference in New Issue
Block a user