Browse Source

fix: handle invalid limit numbers

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2318/head
Pranav C 2 years ago
parent
commit
f7d39de825
  1. 7
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

7
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -70,9 +70,9 @@ class BaseModelSqlv2 {
private _columns = {};
private config: any = {
limitDefault: process.env.DB_QUERY_LIMIT_DEFAULT || 25,
limitMin: process.env.DB_QUERY_LIMIT_MIN || 1,
limitMax: process.env.DB_QUERY_LIMIT_MAX || 1000
limitDefault: Math.max(+process.env.DB_QUERY_LIMIT_DEFAULT || 25, 1),
limitMin: Math.max(+process.env.DB_QUERY_LIMIT_MIN || 1, 1),
limitMax: Math.max(+process.env.DB_QUERY_LIMIT_MAX || 1000, 1)
};
constructor({
@ -1370,6 +1370,7 @@ class BaseModelSqlv2 {
get isPg() {
return this.clientType === 'pg';
}
get isMySQL() {
return this.clientType === 'mysql2' || this.clientType === 'mysql';
}

Loading…
Cancel
Save