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

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

No files matched your search

+1 -1
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