From 5391bfc1efb0e7b6153748ed2e8abc953c8da438 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 4 Jan 2024 13:19:27 +0000 Subject: [PATCH] fix: validate update payload --- packages/nocodb/src/db/BaseModelSqlv2.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index cd98f1bd97..ec04fd37ea 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -3198,6 +3198,13 @@ class BaseModelSqlv2 { try { if (raw) await this.model.getColumns(); + // validate update data + if (!raw) { + for (const d of datas) { + await this.validate(d); + } + } + const updateDatas = raw ? datas : await Promise.all( @@ -3211,7 +3218,6 @@ class BaseModelSqlv2 { const updatePkValues = []; const toBeUpdated = []; for (const d of updateDatas) { - if (!raw) await this.validate(d); const pkValues = await this._extractPksValues(d); if (!pkValues) { // throw or skip if no pk provided