File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ module.exports = async function (next) {
3636 secret : this . utils . randString ( ) ,
3737 showError : true ,
3838 strict : false ,
39+ limit : 100 ,
3940 production : 'auto' ,
4041 db : {
4142 driver : 'Memory'
Original file line number Diff line number Diff line change @@ -497,13 +497,24 @@ module.exports = class Storage {
497497 /* Check if we're logged in */
498498 this . app . user . isUserAuthenticatedForRoute ( request , response ) ;
499499
500+ /* Parse max limit */
501+ const limit = ( this . config . limit && this . config . limit > 0 ) ? this . config . limit : false ;
502+
500503 /* Parse limit options */
501504 if ( 'limit' in request . query ) {
502505 options . limit = Number ( request . query . limit ) || null ;
503506
507+ /* If max limit is set in config, ensure we don't go over it */
508+ if ( limit && options . limit > limit ) {
509+ options . limit = limit ;
510+ }
511+
504512 if ( 'skip' in request . query ) {
505513 options . skip = Number ( request . query . skip ) || null ;
506514 }
515+ } else if ( limit ) {
516+ /* If max limit is set in config, enforce it */
517+ options . limit = limit ;
507518 }
508519
509520 /* Parse sorting option */
You can’t perform that action at this time.
0 commit comments