Remove backend max atoms / depth settings
This commit is contained in:
parent
028e5245e8
commit
301e875308
@ -81,7 +81,6 @@
|
||||
#PAPERLESS_THUMBNAIL_FONT_NAME=
|
||||
#PAPERLESS_IGNORE_DATES=
|
||||
#PAPERLESS_ENABLE_UPDATE_CHECK=
|
||||
#PAPERLESS_ALLOW_CUSTOM_FIELD_LOOKUP=iexact,contains,startswith,endswith,regex,iregex
|
||||
|
||||
# Tika settings
|
||||
|
||||
|
@ -30,13 +30,15 @@ from documents.models import Log
|
||||
from documents.models import ShareLink
|
||||
from documents.models import StoragePath
|
||||
from documents.models import Tag
|
||||
from paperless import settings
|
||||
|
||||
CHAR_KWARGS = ["istartswith", "iendswith", "icontains", "iexact"]
|
||||
ID_KWARGS = ["in", "exact"]
|
||||
INT_KWARGS = ["exact", "gt", "gte", "lt", "lte", "isnull"]
|
||||
DATE_KWARGS = ["year", "month", "day", "date__gt", "gt", "date__lt", "lt"]
|
||||
|
||||
CUSTOM_FIELD_LOOKUP_MAX_DEPTH = 10
|
||||
CUSTOM_FIELD_LOOKUP_MAX_ATOMS = 20
|
||||
|
||||
|
||||
class CorrespondentFilterSet(FilterSet):
|
||||
class Meta:
|
||||
@ -394,13 +396,7 @@ class CustomFieldLookupParser:
|
||||
self._atom_count += 1
|
||||
if self._atom_count > self._max_atom_count:
|
||||
raise serializers.ValidationError(
|
||||
[
|
||||
_(
|
||||
"Maximum number of query conditions exceeded. You can raise "
|
||||
"the limit by setting PAPERLESS_CUSTOM_FIELD_LOOKUP_MAX_ATOMS "
|
||||
"in your configuration file.",
|
||||
),
|
||||
],
|
||||
[_("Maximum number of query conditions exceeded.")],
|
||||
)
|
||||
|
||||
custom_field = self._get_custom_field(id_or_name, validation_prefix="0")
|
||||
@ -597,15 +593,7 @@ class CustomFieldLookupParser:
|
||||
# guard against queries that are too deeply nested
|
||||
self._current_depth += 1
|
||||
if self._current_depth > self._max_query_depth:
|
||||
raise serializers.ValidationError(
|
||||
[
|
||||
_(
|
||||
"Maximum nesting depth exceeded. You can raise the limit "
|
||||
"by setting PAPERLESS_CUSTOM_FIELD_LOOKUP_MAX_DEPTH in "
|
||||
"your configuration file.",
|
||||
),
|
||||
],
|
||||
)
|
||||
raise serializers.ValidationError([_("Maximum nesting depth exceeded.")])
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
@ -629,8 +617,8 @@ class CustomFieldLookupFilter(Filter):
|
||||
|
||||
parser = CustomFieldLookupParser(
|
||||
self._validation_prefix,
|
||||
max_query_depth=settings.CUSTOM_FIELD_LOOKUP_MAX_DEPTH,
|
||||
max_atom_count=settings.CUSTOM_FIELD_LOOKUP_MAX_ATOMS,
|
||||
max_query_depth=CUSTOM_FIELD_LOOKUP_MAX_DEPTH,
|
||||
max_atom_count=CUSTOM_FIELD_LOOKUP_MAX_ATOMS,
|
||||
)
|
||||
q, annotations = parser.parse(value)
|
||||
|
||||
|
@ -1195,16 +1195,3 @@ EMAIL_ENABLE_GPG_DECRYPTOR: Final[bool] = __get_boolean(
|
||||
# Soft Delete #
|
||||
###############################################################################
|
||||
EMPTY_TRASH_DELAY = max(__get_int("PAPERLESS_EMPTY_TRASH_DELAY", 30), 1)
|
||||
|
||||
###############################################################################
|
||||
# custom_field_lookup Filter Settings #
|
||||
###############################################################################
|
||||
|
||||
CUSTOM_FIELD_LOOKUP_MAX_DEPTH = __get_int(
|
||||
"PAPERLESS_CUSTOM_FIELD_LOOKUP_MAX_DEPTH",
|
||||
default=10,
|
||||
)
|
||||
CUSTOM_FIELD_LOOKUP_MAX_ATOMS = __get_int(
|
||||
"PAPERLESS_CUSTOM_FIELD_LOOKUP_MAX_ATOMS",
|
||||
default=20,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user