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:
parent
16c8750bab
commit
33d2afc26d
|
@ -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(fmt.Sprintf("Content-Type: multipart/mixed; boundary=\"%s\"\n", mimeWriter.Boundary())))
|
||||||
|
writer.Write([]byte("MIME-Version: 1.0\r\n"))
|
||||||
|
|
||||||
for _, part := range parts {
|
for _, part := range parts {
|
||||||
header := textproto.MIMEHeader{}
|
header := textproto.MIMEHeader{}
|
||||||
|
@ -179,6 +180,9 @@ func renderPartsToWriter(parts cloudInitParts, writer io.Writer) error {
|
||||||
header.Set("Content-Type", part.ContentType)
|
header.Set("Content-Type", part.ContentType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
header.Set("MIME-Version", "1.0")
|
||||||
|
header.Set("Content-Transfer-Encoding", "7bit")
|
||||||
|
|
||||||
if part.Filename != "" {
|
if part.Filename != "" {
|
||||||
header.Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, part.Filename))
|
header.Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, part.Filename))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue