summaryrefslogtreecommitdiff
path: root/cloudinit/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/handlers')
-rw-r--r--cloudinit/handlers/__init__.py11
1 files changed, 1 insertions, 10 deletions
diff --git a/cloudinit/handlers/__init__.py b/cloudinit/handlers/__init__.py
index cdccf122..6b7abbcd 100644
--- a/cloudinit/handlers/__init__.py
+++ b/cloudinit/handlers/__init__.py
@@ -233,16 +233,7 @@ def walk(msg, callback, data):
headers = dict(part)
LOG.debug(headers)
headers['Content-Type'] = ctype
- payload = part.get_payload(decode=True)
- # In Python 3, decoding the payload will ironically hand us a bytes
- # object. 'decode' means to decode according to
- # Content-Transfer-Encoding, not according to any charset in the
- # Content-Type. So, if we end up with bytes, first try to decode to
- # str via CT charset, and failing that, try utf-8 using surrogate
- # escapes.
- if six.PY3 and isinstance(payload, bytes):
- charset = part.get_charset() or 'utf-8'
- payload = payload.decode(charset, errors='surrogateescape')
+ payload = util.fully_decoded_payload(part)
callback(data, filename, payload, headers)
partnum = partnum + 1