Skip to content

Commit

Permalink
feat(manager): limit page size to 100
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomáš Sasák committed Nov 27, 2023
1 parent fd0ec91 commit aad4eae
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion manager/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@

IDENTITY_HEADER = "x-rh-identity"
DEFAULT_PAGE_SIZE = 20
MAXIMUM_PAGE_SIZE = 100
DEFAULT_BUSINESS_RISK = "Not Defined"
DEFAULT_STATUS = "Not Reviewed"
CVE_SYNOPSIS_SORT = [fn.SUBSTRING(SQL("cve_name"), r"-(\d+)-").cast("integer"),
Expand Down Expand Up @@ -274,7 +275,10 @@ def _parse_list_arguments(cls, kwargs):

data_format = kwargs.get("data_format", "json")
if data_format not in ["json", "csv"]:
raise InvalidArgumentException("Invalid data format: %s" % kwargs.get("data_format", None))
raise InvalidArgumentException(f"Invalid data format: {kwargs.get('data_format', None)}")

if limit > MAXIMUM_PAGE_SIZE and UI_REFERER not in connexion.request.headers.get("referer", ""):
raise InvalidArgumentException(f"Page limit of size: {limit} is too high, maximum is {MAXIMUM_PAGE_SIZE}")

return {
"filter": remove_str_nulls(kwargs.get("filter", None)),
Expand Down

0 comments on commit aad4eae

Please sign in to comment.