forked from Silverfish/proton-bridge
fix(GODT-1804): Only promote content headers if non-empty
When attaching public key, we take the root mime part, create a new root, and put the old root alongside an additional public key mime part. But when moving the root, we would copy all content headers, even empty ones. So we’d be left with Content-Disposition: "" which would fail to parse.
This commit is contained in:
@ -186,9 +186,17 @@ func (p *Part) isMultipartMixed() bool {
|
||||
func getContentHeaders(header message.Header) message.Header {
|
||||
var res message.Header
|
||||
|
||||
res.Set("Content-Type", header.Get("Content-Type"))
|
||||
res.Set("Content-Disposition", header.Get("Content-Disposition"))
|
||||
res.Set("Content-Transfer-Encoding", header.Get("Content-Transfer-Encoding"))
|
||||
if contentType := header.Get("Content-Type"); contentType != "" {
|
||||
res.Set("Content-Type", contentType)
|
||||
}
|
||||
|
||||
if contentDisposition := header.Get("Content-Disposition"); contentDisposition != "" {
|
||||
res.Set("Content-Disposition", contentDisposition)
|
||||
}
|
||||
|
||||
if contentTransferEncoding := header.Get("Content-Transfer-Encoding"); contentTransferEncoding != "" {
|
||||
res.Set("Content-Transfer-Encoding", contentTransferEncoding)
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user