From 51b952f487d5b00a3d05cc6fb8254428bb332787 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Fri, 26 Jan 2024 11:34:45 +0000 Subject: [PATCH] fix(nocodb): select field issue with trailing spaces when creating using API --- .../nocodb/src/helpers/getColumnPropsFromUIDT.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/nocodb/src/helpers/getColumnPropsFromUIDT.ts b/packages/nocodb/src/helpers/getColumnPropsFromUIDT.ts index 26c4fac99b..9cd65ab105 100644 --- a/packages/nocodb/src/helpers/getColumnPropsFromUIDT.ts +++ b/packages/nocodb/src/helpers/getColumnPropsFromUIDT.ts @@ -27,17 +27,18 @@ export default async function getColumnPropsFromUIDT( newColumn.dtxs = sqlUi.getDefaultScaleForDatatype(newColumn.dt); const selectTypes = [UITypes.MultiSelect, UITypes.SingleSelect]; - if ( - column && - selectTypes.includes(newColumn.uidt) && - selectTypes.includes(column.uidt as UITypes) - ) { - newColumn.dtxp = (column as NormalColumnRequestType).dtxp; + if (column && selectTypes.includes(column.uidt as UITypes)) { + newColumn.dtxp = + typeof (column as NormalColumnRequestType).dtxp === 'string' + ? ((column as NormalColumnRequestType).dtxp as string) + .trim() + .replace(/'\s*,\s*'/g, "','") + : (column as NormalColumnRequestType).dtxp; } newColumn.altered = column.altered || 2; - const finalColumnMeta = { ...newColumn, ...column }; + const finalColumnMeta = { ...column, ...newColumn }; if ( finalColumnMeta.uidt === UITypes.CreatedTime &&