Skip to content

Commit

Permalink
Do not apply JSONContainsFilter when no value is provided #153
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Druez <tdruez@nexb.com>
  • Loading branch information
tdruez committed Apr 20, 2021
1 parent 7189a53 commit d74d385
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scanpipe/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class JSONContainsFilter(django_filters.CharFilter):
"""

def filter(self, qs, value):
return qs.json_field_contains(self.field_name, value)
if value:
return qs.json_field_contains(self.field_name, value)
return qs


class ResourceFilterSet(django_filters.FilterSet):
Expand Down

0 comments on commit d74d385

Please # to comment.