fix types
This commit is contained in:
parent
822b90edaa
commit
e5c065416f
|
@ -1055,7 +1055,7 @@ class objectProcessor(threading.Thread):
|
|||
logger.info('ackdata checksum wrong. Not sending ackdata.')
|
||||
return False
|
||||
command = command.rstrip(b'\x00')
|
||||
if command != 'object':
|
||||
if command != b'object':
|
||||
return False
|
||||
return True
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
Message encoding end decoding functions
|
||||
"""
|
||||
|
||||
import string
|
||||
import zlib
|
||||
|
||||
import messagetypes
|
||||
|
@ -100,14 +99,14 @@ class MsgDecode(object):
|
|||
def decodeExtended(self, data):
|
||||
"""Handle extended encoding"""
|
||||
dc = zlib.decompressobj()
|
||||
tmp = ""
|
||||
tmp = b""
|
||||
while len(tmp) <= config.safeGetInt("zlib", "maxsize"):
|
||||
try:
|
||||
got = dc.decompress(
|
||||
data, config.safeGetInt("zlib", "maxsize")
|
||||
+ 1 - len(tmp))
|
||||
# EOF
|
||||
if got == "":
|
||||
if got == b"":
|
||||
break
|
||||
tmp += got
|
||||
data = dc.unconsumed_tail
|
||||
|
@ -143,7 +142,7 @@ class MsgDecode(object):
|
|||
|
||||
def decodeSimple(self, data):
|
||||
"""Handle simple encoding"""
|
||||
bodyPositionIndex = string.find(data, '\nBody:')
|
||||
bodyPositionIndex = data.find(b'\nBody:')
|
||||
if bodyPositionIndex > 1:
|
||||
subject = data[8:bodyPositionIndex]
|
||||
# Only save and show the first 500 characters of the subject.
|
||||
|
@ -151,10 +150,10 @@ class MsgDecode(object):
|
|||
subject = subject[:500]
|
||||
body = data[bodyPositionIndex + 6:]
|
||||
else:
|
||||
subject = ''
|
||||
subject = b''
|
||||
body = data
|
||||
# Throw away any extra lines (headers) after the subject.
|
||||
if subject:
|
||||
subject = subject.splitlines()[0]
|
||||
self.subject = subject
|
||||
self.body = body
|
||||
self.subject = subject.decode("utf-8", "replace")
|
||||
self.body = body.decode("utf-8", "replace")
|
||||
|
|
Reference in New Issue
Block a user