From 234fca90a3f41ee522cda83adc7b54b482bd8ab8 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Tue, 26 Sep 2017 19:30:35 +0530 Subject: [PATCH] Encode content if not encoded before hashing --- frappe/utils/file_manager.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frappe/utils/file_manager.py b/frappe/utils/file_manager.py index de0ebdf12f..822b63e240 100644 --- a/frappe/utils/file_manager.py +++ b/frappe/utils/file_manager.py @@ -301,6 +301,8 @@ def get_file_path(file_name): return file_path def get_content_hash(content): + if isinstance(content, text_type): + content = content.encode() return hashlib.md5(content).hexdigest() def get_file_name(fname, optional_suffix):