Fix message.payload_type

This commit is contained in:
giacomo.tanganelli@for.unipi.it 2018-01-29 14:56:12 +01:00
parent 9f608e46ea
commit 418143f9df

View file

@ -113,9 +113,12 @@ class Serializer(object):
raise AttributeError("Packet length %s, pos %s" % (length_packet, pos))
message.payload = ""
payload = values[pos:]
if message.payload_type == defines.Content_types["application/octet-stream"]:
message.payload = payload
else:
try:
if message.payload_type == defines.Content_types["application/octet-stream"]:
message.payload = payload
else:
message.payload = payload.decode("utf-8")
except AttributeError:
message.payload = payload.decode("utf-8")
pos += len(payload)