Merge pull request #78 from pbrln/master

fixes cleanup logic, adds html decoding
This commit is contained in:
Christian Haschek 2024-02-08 14:59:50 +01:00 committed by GitHub
commit b7ca0858b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -73,7 +73,7 @@ class CustomHandler:
else:
plaintext += part.get_payload(decode=True).decode('utf-8')
elif part.get_content_type() == 'text/html':
html += part.get_payload()
html += part.get_payload().get_payload(decode=True).decode('utf-8')
else:
att = self.handleAttachment(part)
if(att == False):
@ -190,6 +190,7 @@ def cleanup():
if(DELETE_OLDER_THAN_DAYS == False or time.time() - LAST_CLEANUP < 86400):
return
logger.info("Cleaning up")
LAST_CLEANUP = time.time()
rootdir = '../data/'
for subdir, dirs, files in os.walk(rootdir):
for file in files: