fix: catch correct exception when parsing filter (#15458)

This commit is contained in:
Peter Braun 2024-08-22 16:12:54 +02:00 committed by GitHub
parent 1b5cdf6bef
commit c6223c076f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,7 @@
import re
from functools import reduce
from django.core.exceptions import FieldDoesNotExist
from pyparsing import (
infixNotation,
opAssoc,
@ -353,7 +355,7 @@ class SmartFilter(object):
try:
res = boolExpr.parseString('(' + filter_string + ')')
except ParseException:
except (ParseException, FieldDoesNotExist):
raise RuntimeError(u"Invalid query %s" % filter_string_raw)
if len(res) > 0: