From 9d8f6d4ed92aa49c2a1fb014e6d08933f9653cf0 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Wed, 24 Jun 2026 20:37:30 +0530 Subject: [PATCH] refactor: parse native JSON request args in accounts/doctype/bank_statement_import_log/bank_statement_import_log.py Use frappe.parse_json instead of json.loads so the whitelisted endpoints accept native JSON types (list/dict/bool) in addition to JSON strings. --- .../bank_statement_import_log.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/bank_statement_import_log/bank_statement_import_log.py b/erpnext/accounts/doctype/bank_statement_import_log/bank_statement_import_log.py index f50549befa1..783ebf23870 100644 --- a/erpnext/accounts/doctype/bank_statement_import_log/bank_statement_import_log.py +++ b/erpnext/accounts/doctype/bank_statement_import_log/bank_statement_import_log.py @@ -1183,8 +1183,7 @@ def update_pdf_tables(statement_import_id: str, tables: list | str): if doc.status == "Completed": frappe.throw(_("This statement has already been imported."), title=_("Already Imported")) - if isinstance(tables, str): - tables = json.loads(tables) + tables = frappe.parse_json(tables) doc.apply_pdf_tables(tables) @@ -1204,8 +1203,7 @@ def reextract_pdf_table(statement_import_id: str, page: int, table_index: int, b if doc.status == "Completed": frappe.throw(_("This statement has already been imported."), title=_("Already Imported")) - if isinstance(bbox, str): - bbox = json.loads(bbox) + bbox = frappe.parse_json(bbox) page = int(page) table_index = int(table_index) @@ -1290,8 +1288,7 @@ def update_column_mapping(statement_import_id: str, column_mapping: list | str): if doc.status == "Completed": frappe.throw(_("This statement has already been imported."), title=_("Already Imported")) - if isinstance(column_mapping, str): - column_mapping = json.loads(column_mapping) + column_mapping = frappe.parse_json(column_mapping) doc.apply_column_mapping(column_mapping) doc.save()