summaryrefslogtreecommitdiff
path: root/cloudinit/user_data.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2013-07-20 14:57:42 -0700
committerJoshua Harlow <harlowja@gmail.com>2013-07-20 14:57:42 -0700
commit64c69053c11385cc43b6c628dbe8a1bf28ccc49c (patch)
tree7b63872f140d6ce7baec67c578565298b6932fc3 /cloudinit/user_data.py
parent7880588f804ea035f03eba9335af71f3322dab97 (diff)
downloadvyos-cloud-init-64c69053c11385cc43b6c628dbe8a1bf28ccc49c.tar.gz
vyos-cloud-init-64c69053c11385cc43b6c628dbe8a1bf28ccc49c.zip
Keep filename from original part.
Diffstat (limited to 'cloudinit/user_data.py')
-rw-r--r--cloudinit/user_data.py8
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)