Encode folder name before md5

Avoid the error:

Unicode-objects must be encoded before hashing
This commit is contained in:
Rodolfo García Peñas (kix) 2020-08-28 16:51:11 +02:00
parent 22dfbd7a54
commit bb5b1f2dcf

View File

@ -74,7 +74,7 @@ class MaildirFolder(BaseFolder):
# Everything up to the first comma or colon (or ! if Windows):
self.re_prefixmatch = re.compile('([^'+ self.infosep + ',]*)')
# folder's md, so we can match with recorded file md5 for validity.
self._foldermd5 = md5(self.getvisiblename()).hexdigest()
self._foldermd5 = md5(self.getvisiblename().encode('utf-8')).hexdigest()
# Cache the full folder path, as we use getfullname() very often.
self._fullname = os.path.join(self.getroot(), self.getname())
# Modification time from 'Date' header.