Added to redirect when the page size is invalid in the Pagination utility.

This commit is contained in:
2023-02-04 10:55:49 +08:00
parent 62697fb782
commit 5090e59bb1
2 changed files with 4 additions and 1 deletions

View File

@ -117,7 +117,7 @@ class Pagination(t.Generic[T]):
page_size: int = int(request.args["page-size"])
except ValueError:
raise Redirection(self.__uri_set("page-size", None))
if page_size == self.DEFAULT_PAGE_SIZE:
if page_size == self.DEFAULT_PAGE_SIZE or page_size < 1:
raise Redirection(self.__uri_set("page-size", None))
return page_size