Merge pull request #11 from patrickdepinguin/py3fix

Some more Python 3 related fixes.
This commit is contained in:
Rodolfo García Peñas (kix) 2020-10-25 15:43:47 +01:00 committed by GitHub
commit b741da2853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,7 +219,7 @@ class IMAPFolder(BaseFolder):
OfflineImapError.ERROR.FOLDER) OfflineImapError.ERROR.FOLDER)
# Davmail returns list instead of list of one element string. # Davmail returns list instead of list of one element string.
# On first run the first element is empty. # On first run the first element is empty.
if ' ' in res_data[0] or res_data[0] == '': if b' ' in res_data[0] or res_data[0] == b'':
res_data = res_data[0].split() res_data = res_data[0].split()
# Some servers are broken. # Some servers are broken.
if 0 in res_data: if 0 in res_data:
@ -839,7 +839,7 @@ class IMAPFolder(BaseFolder):
# Convert bytes to str # Convert bytes to str
ndata0 = data[0][0].decode('utf-8') ndata0 = data[0][0].decode('utf-8')
ndata1 = data[0][1].decode('utf-8') ndata1 = data[0][1].decode('utf-8', errors='replace')
ndata = [ndata0, ndata1] ndata = [ndata0, ndata1]
return ndata return ndata