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)) raise AttributeError("Packet length %s, pos %s" % (length_packet, pos))
message.payload = "" message.payload = ""
payload = values[pos:] payload = values[pos:]
if message.payload_type == defines.Content_types["application/octet-stream"]: try:
message.payload = payload if message.payload_type == defines.Content_types["application/octet-stream"]:
else: message.payload = payload
else:
message.payload = payload.decode("utf-8")
except AttributeError:
message.payload = payload.decode("utf-8") message.payload = payload.decode("utf-8")
pos += len(payload) pos += len(payload)