refactor: simplify get_safe_filters guard for readability
This commit is contained in:
parent
ff83bb1473
commit
46fd36d542
1 changed files with 6 additions and 8 deletions
|
|
@ -904,14 +904,12 @@ def call(fn, *args, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def get_safe_filters(filters):
|
def get_safe_filters(filters):
|
||||||
if not isinstance(filters, str) or not filters or filters[0] not in "{[":
|
if isinstance(filters, str) and filters and filters[0] in "{[":
|
||||||
return filters
|
try:
|
||||||
try:
|
return orjson.loads(filters)
|
||||||
filters = orjson.loads(filters)
|
except (TypeError, ValueError):
|
||||||
except (TypeError, ValueError):
|
# filters are not passed, not json
|
||||||
# filters are not passed, not json
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
return filters
|
return filters
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue