fix(db_query): double-escaped value (#32376)
This commit is contained in:
parent
479c304eae
commit
42f1d1b460
2 changed files with 7 additions and 2 deletions
|
|
@ -882,11 +882,11 @@ class DatabaseQuery:
|
|||
value = value.replace("\\", "\\\\").replace("%", "%%")
|
||||
|
||||
elif f.operator == "=" and df and df.fieldtype in ("Link", "Data", "Dynamic Link"):
|
||||
value = cstr(f.value) or "''"
|
||||
value = cstr(f.value)
|
||||
fallback = "''"
|
||||
|
||||
elif f.fieldname == "name":
|
||||
value = f.value or "''"
|
||||
value = f.value
|
||||
fallback = "''"
|
||||
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -1196,6 +1196,11 @@ class TestDBQuery(IntegrationTestCase):
|
|||
self.assertEqual(count[0], frappe.db.count("Language"))
|
||||
self.assertEqual(count[1], frappe.db.count("Language"))
|
||||
|
||||
def test_ifnull_none(self):
|
||||
query = frappe.get_all("DocField", {"fieldname": None}, run=0)
|
||||
self.assertIn("''", query)
|
||||
self.assertNotIn("\\'", query)
|
||||
|
||||
|
||||
class TestReportView(IntegrationTestCase):
|
||||
@run_only_if(db_type_is.MARIADB) # TODO: postgres name casting is messed up
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue