Add headers to output

The original implmentation was missing headers to denote mime version &
content transfer encoding, this caused issues with EC2.

Signed-off-by: Simon Thulbourn <simon+github@thulbourn.com>
This commit is contained in:
Simon Thulbourn 2015-12-07 13:41:52 +00:00 committed by James Nugent
parent 16c8750bab
commit 33d2afc26d
1 changed files with 4 additions and 0 deletions

View File

@ -170,6 +170,7 @@ func renderPartsToWriter(parts cloudInitParts, writer io.Writer) error {
}
writer.Write([]byte(fmt.Sprintf("Content-Type: multipart/mixed; boundary=\"%s\"\n", mimeWriter.Boundary())))
writer.Write([]byte("MIME-Version: 1.0\r\n"))
for _, part := range parts {
header := textproto.MIMEHeader{}
@ -179,6 +180,9 @@ func renderPartsToWriter(parts cloudInitParts, writer io.Writer) error {
header.Set("Content-Type", part.ContentType)
}
header.Set("MIME-Version", "1.0")
header.Set("Content-Transfer-Encoding", "7bit")
if part.Filename != "" {
header.Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, part.Filename))
}