Selaa lähdekoodia

fix: file upload via url

version-14
Rushabh Mehta 6 vuotta sitten
vanhempi
commit
6c7be62f24
2 muutettua tiedostoa jossa 6 lisäystä ja 2 poistoa
  1. +2
    -2
      frappe/core/doctype/file/file.py
  2. +4
    -0
      frappe/utils/global_search.py

+ 2
- 2
frappe/core/doctype/file/file.py Näytä tiedosto

@@ -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


+ 4
- 0
frappe/utils/global_search.py Näytä tiedosto

@@ -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"):


Ladataan…
Peruuta
Tallenna