Update block_wrapper.py
All checks were successful
CI Workflow / Testing the Block (push) Successful in 9s
CI Workflow / Containerize the Block (push) Successful in 46s

This commit is contained in:
admin user 2025-11-27 00:37:14 +00:00
parent d3762e483b
commit c3b127d5f4

View File

@ -111,9 +111,13 @@ def construct_sql(input_data):
replacement = "NULL"
elif isinstance(value, bool):
replacement = "TRUE" if value else "FALSE"
elif isinstance(value, (list, tuple)):
# Serialize list/tuple safely to avoid quote issues in SQL.
replacement = f"'{json.dumps(value)}'"
elif isinstance(value, str):
# Escape quotes if needed, or just do naive single quote
replacement = f"'{value}'"
# Escape single quotes to keep SQL well-formed.
sanitized = value.replace("'", "''")
replacement = f"'{sanitized}'"
else:
replacement = str(value)
@ -273,4 +277,4 @@ async def main():
raise
if __name__ == "__main__":
asyncio.run(main())
asyncio.run(main())