From f905094fdbf9b0fcfb535d65dea2b0a8a73368c4 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 5 Nov 2015 14:35:43 +0530 Subject: [PATCH] [fix] patch in file-url --- frappe/patches/v6_6/fix_file_url.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/frappe/patches/v6_6/fix_file_url.py b/frappe/patches/v6_6/fix_file_url.py index 1313bb013a..4f8956d343 100644 --- a/frappe/patches/v6_6/fix_file_url.py +++ b/frappe/patches/v6_6/fix_file_url.py @@ -11,11 +11,15 @@ def fix_file_urls(): for file in frappe.db.sql_list("""select name from `tabFile` where file_url like 'files/%'"""): file = frappe.get_doc("File", file) file.db_set("file_url", "/" + file.file_url, update_modified=False) - file.validate_file() - file.db_set("file_name", file.file_name, update_modified=False) - if not file.content_hash: - file.generate_content_hash() - file.db_set("content_hash", file.content_hash, update_modified=False) + try: + file.validate_file() + file.db_set("file_name", file.file_name, update_modified=False) + if not file.content_hash: + file.generate_content_hash() + file.db_set("content_hash", file.content_hash, update_modified=False) + + except IOError: + pass def fix_attach_field_urls(): # taken from an old patch