aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/pagination.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-09 09:36:31 +0100
committerChocobozzz <me@florianbigard.com>2020-01-09 09:36:31 +0100
commite0b56b7495e809581a1e6447794bf7573a78af56 (patch)
tree7bf3917b7109fc8d671c994b4f501fd020257b38 /server/middlewares/pagination.ts
parent240458d0c95133bfb03a3f695a1b4e5cb63e20ef (diff)
downloadPeerTube-e0b56b7495e809581a1e6447794bf7573a78af56.tar.gz
PeerTube-e0b56b7495e809581a1e6447794bf7573a78af56.tar.zst
PeerTube-e0b56b7495e809581a1e6447794bf7573a78af56.zip
Return an error on invalid count pagination
Diffstat (limited to 'server/middlewares/pagination.ts')
-rw-r--r--server/middlewares/pagination.ts4
1 files changed, 1 insertions, 3 deletions
diff --git a/server/middlewares/pagination.ts b/server/middlewares/pagination.ts
index 043869303..b59717d7b 100644
--- a/server/middlewares/pagination.ts
+++ b/server/middlewares/pagination.ts
@@ -5,11 +5,9 @@ function setDefaultPagination (req: express.Request, res: express.Response, next
5 if (!req.query.start) req.query.start = 0 5 if (!req.query.start) req.query.start = 0
6 else req.query.start = parseInt(req.query.start, 10) 6 else req.query.start = parseInt(req.query.start, 10)
7 7
8 if (!req.query.count) req.query.count = PAGINATION.COUNT.DEFAULT 8 if (!req.query.count) req.query.count = PAGINATION.GLOBAL.COUNT.DEFAULT
9 else req.query.count = parseInt(req.query.count, 10) 9 else req.query.count = parseInt(req.query.count, 10)
10 10
11 if (req.query.count > PAGINATION.COUNT.MAX) req.query.count = PAGINATION.COUNT.MAX
12
13 return next() 11 return next()
14} 12}
15 13