From f8a9678e730d29bab946d9ff04e7c099b2cc7459 Mon Sep 17 00:00:00 2001 From: Achilles Rasquinha Date: Mon, 12 Mar 2018 14:26:34 +0530 Subject: [PATCH] read bytes instead of string --- frappe/core/doctype/file/file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/core/doctype/file/file.py b/frappe/core/doctype/file/file.py index 80a7d8dc0c..0c2ece6e88 100755 --- a/frappe/core/doctype/file/file.py +++ b/frappe/core/doctype/file/file.py @@ -173,7 +173,7 @@ class File(NestedSet): if self.file_url.startswith("/files/"): try: - with open(get_files_path(self.file_name.lstrip("/")), "r") as f: + with open(get_files_path(self.file_name.lstrip("/")), "rb") as f: self.content_hash = get_content_hash(f.read()) except IOError: frappe.msgprint(_("File {0} does not exist").format(self.file_url))