diff --git a/frappe/core/doctype/file/file.py b/frappe/core/doctype/file/file.py index cc36174037..4936870e88 100755 --- a/frappe/core/doctype/file/file.py +++ b/frappe/core/doctype/file/file.py @@ -94,7 +94,7 @@ class File(NestedSet): self.validate_file_name() self.validate_folder() - if not self.flags.ignore_file_validate: + if not self.file_url and not self.flags.ignore_file_validate: if not self.is_folder: self.validate_file() self.generate_content_hash() @@ -384,7 +384,7 @@ class File(NestedSet): elif file_path.startswith("/files/"): file_path = get_files_path(*file_path.split("/files/", 1)[1].split("/")) - else: + elif not self.file_url: frappe.throw(_("There is some problem with the file url: {0}").format(file_path)) return file_path diff --git a/frappe/utils/global_search.py b/frappe/utils/global_search.py index 33dbd76471..fe2eeb2c0a 100644 --- a/frappe/utils/global_search.py +++ b/frappe/utils/global_search.py @@ -62,6 +62,8 @@ def rebuild_for_doctype(doctype): searchable fields :param doctype: Doctype """ + if frappe.local.conf.get('disable_global_search'): + return def _get_filters(): filters = frappe._dict({ "docstatus": ["!=", 2] }) @@ -219,6 +221,8 @@ def update_global_search(doc): `frappe.flags.update_global_search` from given doc :param doc: Document to be added to global search """ + if frappe.local.conf.get('disable_global_search'): + return if doc.docstatus > 1 or (doc.meta.has_field("enabled") and not doc.get("enabled")) \ or doc.get("disabled"):