Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/loadConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module.exports = async function (next) {
secret: this.utils.randString(),
showError: true,
strict: false,
limit: 100,
production: 'auto',
db: {
driver: 'Memory'
Expand Down
11 changes: 11 additions & 0 deletions lib/Storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,24 @@ module.exports = class Storage {
/* Check if we're logged in */
this.app.user.isUserAuthenticatedForRoute(request, response);

/* Parse max limit */
const limit = (this.config.limit && this.config.limit > 0) ? this.config.limit : false;

/* Parse limit options */
if ('limit' in request.query) {
options.limit = Number(request.query.limit) || null;

/* If max limit is set in config, ensure we don't go over it */
if (limit && options.limit > limit) {
options.limit = limit;
}

if ('skip' in request.query) {
options.skip = Number(request.query.skip) || null;
}
} else if (limit) {
/* If max limit is set in config, enforce it */
options.limit = limit;
}

/* Parse sorting option */
Expand Down