fix: stricter validation
This commit is contained in:
parent
9503e7788a
commit
af41d9f8a5
1 changed files with 5 additions and 2 deletions
|
|
@ -407,10 +407,13 @@ def is_document_amended(doctype, docname):
|
|||
return False
|
||||
|
||||
@frappe.whitelist()
|
||||
def validate_link(doctype: str, docname):
|
||||
def validate_link(doctype: str, docname: str):
|
||||
if not isinstance(doctype, str):
|
||||
frappe.throw(_("DocType must be a string"))
|
||||
|
||||
if not isinstance(docname, str):
|
||||
frappe.throw(_("Document Name must be a string"))
|
||||
|
||||
if doctype != "DocType" and not (
|
||||
frappe.has_permission(doctype, "select")
|
||||
or frappe.has_permission(doctype, "read")
|
||||
|
|
@ -420,5 +423,5 @@ def validate_link(doctype: str, docname):
|
|||
.format(frappe.bold(doctype)),
|
||||
frappe.PermissionError
|
||||
)
|
||||
|
||||
|
||||
return frappe.db.get_value(doctype, docname, cache=True)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue