Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow clients of the bridge to set Content-Transfer-Encoding header #516

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pkg/message/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,10 @@ func getTextPartHeader(hdr message.Header, body []byte, mimeType rfc822.MIMEType

hdr.SetContentType(string(mimeType), params)

// Use quoted-printable for all text/... parts
hdr.Set("Content-Transfer-Encoding", "quoted-printable")
// Use quoted-printable for all text/... parts UNLESS header is already set
if !hdr.Has("Content-Transfer-Encoding") {
hdr.Set("Content-Transfer-Encoding", "quoted-printable")
}

return hdr
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/message/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ func (p *Parser) AttachEmptyTextPartIfNoneExists() bool {
h := message.Header{}

h.Set("Content-Type", "text/plain;charset=utf8")
h.Set("Content-Transfer-Encoding", "quoted-printable")
if !h.Has("Content-Transfer-Encoding") {
h.Set("Content-Transfer-Encoding", "quoted-printable")
}

p.Root().AddChild(&Part{
Header: h,
Expand Down