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