[PATCH 07/15] Encode utf-8 argument for md5 function
Nicolas Sebrecht
nicolas.s-dev at laposte.net
Tue May 10 01:37:43 BST 2016
On Tue, May 10, 2016 at 01:18:29AM +0200, Łukasz Żarnowiecki wrote:
> Python3 accepts binary input for md5 function.
>
> Signed-off-by: Łukasz Żarnowiecki <dolohow at outlook.com>
> ---
> offlineimap/folder/Maildir.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py
> index bda452a..95e2553 100644
> --- a/offlineimap/folder/Maildir.py
> +++ b/offlineimap/folder/Maildir.py
> @@ -71,7 +71,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()
I'm not sure about that. I know users out there are using tricks to
enable UTF-8 encoded names. I guess the MD5 will change. This was never
officially supported but I know that if the MD5 changes here this will
harm them.
I wonder it's time to update the --migrate-md5-using-nametrans to a more
generic version. Or introduce yet another CLI option. I don't know.
> # Cache the full folder path, as we use getfullname() very often.
> self._fullname = os.path.join(self.getroot(), self.getname())
--
Nicolas Sebrecht
More information about the OfflineIMAP-project
mailing list