From 638c9ea5b9c53f59040b414304fdcec2c5d3d026 Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Tue, 11 Jul 2023 12:30:07 +0530 Subject: [PATCH 1/2] fix: dont stop next unattached file from being unattached --- frappe/core/doctype/file/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/core/doctype/file/utils.py b/frappe/core/doctype/file/utils.py index 932fce9a03..8f4b326596 100644 --- a/frappe/core/doctype/file/utils.py +++ b/frappe/core/doctype/file/utils.py @@ -319,7 +319,7 @@ def attach_files_to_document(doc: "Document", event) -> None: "attached_to_field": df.fieldname, }, ): - return + continue unattached_file = frappe.db.exists( "File", @@ -341,7 +341,7 @@ def attach_files_to_document(doc: "Document", event) -> None: "attached_to_field": df.fieldname, }, ) - return + continue file: "File" = frappe.get_doc( doctype="File", From 04f8d231a70854334c137922c224aeb1f4dfe01a Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Tue, 11 Jul 2023 12:37:29 +0530 Subject: [PATCH 2/2] fix: dont stop next unattached file from being attached if file_url of first file is invalid --- frappe/core/doctype/file/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/core/doctype/file/utils.py b/frappe/core/doctype/file/utils.py index 8f4b326596..b106ea67c5 100644 --- a/frappe/core/doctype/file/utils.py +++ b/frappe/core/doctype/file/utils.py @@ -308,7 +308,7 @@ def attach_files_to_document(doc: "Document", event) -> None: # we dont want the update to fail if file cannot be attached for some reason value = doc.get(df.fieldname) if not (value or "").startswith(("/files", "/private/files")): - return + continue if frappe.db.exists( "File",