diff --git a/frappe/client.py b/frappe/client.py index 01991e1b51..bd331168c2 100644 --- a/frappe/client.py +++ b/frappe/client.py @@ -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)