From 07d23b2ee0b04503b0f7e34ad00c9d4c483b28d2 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 9 Nov 2023 15:19:35 +0530 Subject: [PATCH] fix: if non-object value passed in Links/LTAR column ignore while inserting --- packages/nocodb/src/db/BaseModelSqlv2.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index ee7616b861..4f7caaa033 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -2635,6 +2635,7 @@ class BaseModelSqlv2 { switch (colOptions.type) { case RelationTypes.BELONGS_TO: { + if (typeof nestedData !== 'object') continue; const childCol = await colOptions.getChildColumn(); const parentCol = await colOptions.getParentColumn(); insertObj[childCol.column_name] = nestedData?.[parentCol.title]; @@ -2642,6 +2643,7 @@ class BaseModelSqlv2 { break; case RelationTypes.HAS_MANY: { + if (!Array.isArray(nestedData)) continue; const childCol = await colOptions.getChildColumn(); const childModel = await childCol.getModel(); await childModel.getColumns(); @@ -2665,6 +2667,7 @@ class BaseModelSqlv2 { } break; case RelationTypes.MANY_TO_MANY: { + if (!Array.isArray(nestedData)) continue; postInsertOps.push( async ( rowId,