Browse Source

fix: if invalid json then skip

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/6817/head
Pranav C 1 year ago
parent
commit
ba16b2989a
  1. 8
      packages/nocodb/src/db/BaseModelSqlv2.ts

8
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -2517,11 +2517,15 @@ class BaseModelSqlv2 {
await col.getColOptions<LinkToAnotherRecordColumn>(); await col.getColOptions<LinkToAnotherRecordColumn>();
// parse data if it's JSON string // parse data if it's JSON string
const nestedData = let nestedData;
try {
nestedData =
typeof data[col.title] === 'string' typeof data[col.title] === 'string'
? JSON.parse(data[col.title]) ? JSON.parse(data[col.title])
: data[col.title]; : data[col.title];
} catch {
continue
}
switch (colOptions.type) { switch (colOptions.type) {
case RelationTypes.BELONGS_TO: case RelationTypes.BELONGS_TO:
{ {

Loading…
Cancel
Save