diff options
| -rw-r--r-- | cloudinit/user_data.py | 8 | 
1 files changed, 6 insertions, 2 deletions
| diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py index 97853e51..e17bcaee 100644 --- a/cloudinit/user_data.py +++ b/cloudinit/user_data.py @@ -130,8 +130,12 @@ class UserDataProcessor(object):              # messages will expect a part not compressed.              if was_compressed:                  maintype, subtype = ctype.split("/", 1) -                part = MIMENonMultipart(maintype, subtype) -                part.set_payload(payload) +                n_part = MIMENonMultipart(maintype, subtype) +                n_part.set_payload(payload) +                if part.get_filename(): +                    n_part.add_header('Content-Disposition', 'attachment', +                                      filename=part.get_filename()) +                part = n_part              if ctype != ctype_orig:                  replace_header(part, CONTENT_TYPE, ctype) | 
