IMAP.py __savemessage_fetchheaders decode bytes
This patch changes the function __savemessage_fetchheaders to decode the bytes retunred by imaplib2. We need a list of headers, with string values, but imapli2 is providing a list with bytes. This change convert the values to str. Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This commit is contained in:
		| @@ -477,6 +477,9 @@ class IMAPFolder(BaseFolder): | ||||
|         # ('185 (RFC822.HEADER {1789}', '... mail headers ...'), ' UID 2444)' | ||||
|         for item in result: | ||||
|             if found is None and type(item) == tuple: | ||||
|                 # Decode the value | ||||
|                 item = [x.decode('utf-8') for x in item] | ||||
|  | ||||
|                 # Walk just tuples. | ||||
|                 if re.search("(?:^|\\r|\\n)%s:\s*%s(?:\\r|\\n)" % (headername, headervalue), | ||||
|                              item[1], flags=re.IGNORECASE): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Rodolfo García Peñas (kix)
					Rodolfo García Peñas (kix)