diff options
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r-- | cloudinit/util.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index c998154a..b845adfd 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -101,6 +101,7 @@ def b64d(source): except UnicodeDecodeError: return decoded + def b64e(source): # Base64 encode some data, accepting bytes or unicode/str, and returning # str/unicode if the result is utf-8 compatible, otherwise returning bytes. @@ -116,7 +117,7 @@ def fully_decoded_payload(part): # bytes, first try to decode to str via CT charset, and failing that, try # utf-8 using surrogate escapes. cte_payload = part.get_payload(decode=True) - if ( six.PY3 and + if (six.PY3 and part.get_content_maintype() == 'text' and isinstance(cte_payload, bytes)): charset = part.get_charset() or 'utf-8' |