|
|
@@ -45,6 +45,7 @@ URL_NOTATION_PATTERN = re.compile( |
|
|
|
) # background-image: url('/assets/...') |
|
|
|
DURATION_PATTERN = re.compile(r"^(?:(\d+d)?((^|\s)\d+h)?((^|\s)\d+m)?((^|\s)\d+s)?)$") |
|
|
|
HTML_TAG_PATTERN = re.compile("<[^>]+>") |
|
|
|
MARIADB_SPECIFIC_COMMENT = re.compile(r"#.*") |
|
|
|
|
|
|
|
|
|
|
|
class Weekday(Enum): |
|
|
@@ -1809,8 +1810,11 @@ def sanitize_column(column_name: str) -> None: |
|
|
|
|
|
|
|
from frappe import _ |
|
|
|
|
|
|
|
regex = re.compile("^.*[,'();].*") |
|
|
|
column_name = sqlparse.format(column_name, strip_comments=True, keyword_case="lower") |
|
|
|
if frappe.db and frappe.db.db_type == "mariadb": |
|
|
|
# strip mariadb specific comments which are like python single line comments |
|
|
|
column_name = MARIADB_SPECIFIC_COMMENT.sub("", column_name) |
|
|
|
|
|
|
|
blacklisted_keywords = [ |
|
|
|
"select", |
|
|
|
"create", |
|
|
@@ -1826,6 +1830,7 @@ def sanitize_column(column_name: str) -> None: |
|
|
|
def _raise_exception(): |
|
|
|
frappe.throw(_("Invalid field name {0}").format(column_name), frappe.DataError) |
|
|
|
|
|
|
|
regex = re.compile("^.*[,'();].*") |
|
|
|
if "ifnull" in column_name: |
|
|
|
if regex.match(column_name): |
|
|
|
# to avoid and, or |
|
|
|