def _decode(self, headers, fileobj):
encoding = headers[-1].get_all("content-transfer-encoding", ["7bit"])[0]
encoding = encoding.lower()
if encoding == "base64":
try:
data = base64.b64decode(fileobj.read())
except TypeError as error:
self.log.error("Base64 decoding failed ({0})".format(error))
idiokit.stop(False)
return StringIO(data)
if encoding == "quoted-printable":
output = StringIO()
quopri.decode(fileobj, output)
output.seek(0)
return output
return fileobj
评论列表
文章目录