fix: only check for special characters in fieldname (#19061)
* fix: only check for special characters in fieldname * chore: revert #18965
This commit is contained in:
parent
53957447b3
commit
2e2f8e8175
2 changed files with 3 additions and 5 deletions
|
|
@ -14,6 +14,7 @@ from requests.exceptions import HTTPError, SSLError
|
|||
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.database.schema import SPECIAL_CHAR_PATTERN
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import call_hook_method, cint, get_files_path, get_hook_method, get_url
|
||||
from frappe.utils.file_manager import is_safe_path
|
||||
|
|
@ -104,10 +105,7 @@ class File(Document):
|
|||
if not self.attached_to_name or not isinstance(self.attached_to_name, (str, int)):
|
||||
frappe.throw(_("Attached To Name must be a string or an integer"), frappe.ValidationError)
|
||||
|
||||
if not self.attached_to_field:
|
||||
return
|
||||
|
||||
if not frappe.get_meta(self.attached_to_doctype).has_field(self.attached_to_field):
|
||||
if self.attached_to_field and SPECIAL_CHAR_PATTERN.search(self.attached_to_field):
|
||||
frappe.throw(_("The fieldname you've specified in Attached To Field is invalid"))
|
||||
|
||||
def after_rename(self, *args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ frappe.ui.form.ControlAttach = class ControlAttach extends frappe.ui.form.Contro
|
|||
if (this.frm) {
|
||||
options.doctype = this.frm.doctype;
|
||||
options.docname = this.frm.docname;
|
||||
options.fieldname = this.grid ? this.grid.df.fieldname : this.df.fieldname;
|
||||
options.fieldname = this.df.fieldname;
|
||||
options.make_attachments_public = this.frm.meta.make_attachments_public;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue