salt.payload.Serial: fix traceback when unpacking binary blob

This commit is contained in:
Erik Johnson 2018-04-09 11:35:46 -05:00
parent 40a49358c9
commit df43ffdb8f
No known key found for this signature in database
GPG key ID: 5E5583C437808F3F

View file

@ -141,7 +141,11 @@ class Serial(object):
# Due to this, if we don't need it, don't pass it at all so
# that under Python 2 we can still work with older versions
# of msgpack.
ret = msgpack.loads(msg, use_list=True, ext_hook=ext_type_decoder, encoding=encoding)
try:
ret = msgpack.loads(msg, use_list=True, ext_hook=ext_type_decoder, encoding=encoding)
except UnicodeDecodeError:
# msg contains binary data
ret = msgpack.loads(msg, use_list=True, ext_hook=ext_type_decoder)
else:
ret = msgpack.loads(msg, use_list=True, ext_hook=ext_type_decoder)
if six.PY3 and encoding is None and not raw: