From f7d39de8259781e9c2f9b7a5a98749645a336a59 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 10 Jun 2022 14:42:04 +0530 Subject: [PATCH] fix: handle invalid limit numbers Signed-off-by: Pranav C --- .../src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts index 95fad14015..547d112cf9 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts +++ b/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'; }