diff options
author | Joshua Harlow <harlowja@gmail.com> | 2013-07-20 16:40:11 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@gmail.com> | 2013-07-20 16:40:11 -0700 |
commit | 251317563bd36a339e6fa7a08a0fc05b5ee975a4 (patch) | |
tree | 7178bb90969913abaf1f5cf71bd5c18b5240e70a | |
parent | 432778cf2890c19940f29f47f9efc2cb8e784f43 (diff) | |
download | vyos-cloud-init-251317563bd36a339e6fa7a08a0fc05b5ee975a4.tar.gz vyos-cloud-init-251317563bd36a339e6fa7a08a0fc05b5ee975a4.zip |
Just check the filename existing.
-rw-r--r-- | cloudinit/user_data.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py index 454f3c06..d49ea094 100644 --- a/cloudinit/user_data.py +++ b/cloudinit/user_data.py @@ -76,8 +76,6 @@ def _replace_header(msg, key, value): def _set_filename(msg, filename): - if not filename: - return del msg['Content-Disposition'] msg.add_header('Content-Disposition', 'attachment', filename=str(filename)) @@ -141,7 +139,8 @@ class UserDataProcessor(object): # Copy various headers from the old part to the new one, # but don't include all the headers since some are not useful # after decoding and decompression. - _set_filename(n_part, part.get_filename()) + if part.get_filename(): + _set_filename(n_part, part.get_filename()) for h in ('Launch-Index',): if h in part: _replace_header(n_part, h, str(part[h])) |