From 4e9dee60937f5124a3546eb7304f89974a25ae89 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Fri, 6 Sep 2013 09:11:10 -0500 Subject: [PATCH] Use StringIO to feed md5 calculation to prevent unicode issues Fixes #4014 --- lib/ansible/utils/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index b5f1886d8d6..de6ab6b533e 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -393,8 +393,9 @@ def merge_hash(a, b): def md5s(data): ''' Return MD5 hex digest of data. ''' + buf = StringIO.StringIO(data) digest = _md5() - digest.update(data.encode('utf-8')) + digest.update(buf.read()) return digest.hexdigest() def md5(filename):