From a9b2aa1d8d4f368bfdb2bd84db663aa455a81fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Sas=C3=A1k?= Date: Fri, 29 Sep 2023 16:25:07 +0200 Subject: [PATCH] fix(manager): fix inventory filters query --- manager/filters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manager/filters.py b/manager/filters.py index f245ccd4d..91c64fdfe 100644 --- a/manager/filters.py +++ b/manager/filters.py @@ -608,7 +608,7 @@ def _filter_inventory_group_names(query, args, _kwargs): object: Modified query with Inventory Group name filter applied """ if names := args.get("group_names"): - expr = Expression(InventoryHosts.groups, "@>", fn.ANY(SQL(f"'{names}'::jsonb[]"))) + expr = Expression(InventoryHosts.groups, "@>", fn.ANY(SQL("%s::jsonb[]", (names,)))) query = query.where(expr) return query @@ -627,7 +627,7 @@ def _filter_inventory_group_ids(query, args, _kwargs): object: Modified query with Inventory Group name filter applied """ if ids := args.get("group_ids"): - expr = Expression(InventoryHosts.groups, "@>", fn.ANY(SQL(f"'{ids}'::jsonb[]"))) + expr = Expression(InventoryHosts.groups, "@>", fn.ANY(SQL("%s::jsonb[]", (ids,)))) query = query.where(expr) return query