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. 16
      packages/nocodb/src/db/BaseModelSqlv2.ts

16
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;
typeof data[col.title] === 'string' try {
? JSON.parse(data[col.title]) nestedData =
: data[col.title]; typeof data[col.title] === 'string'
? JSON.parse(data[col.title])
: data[col.title];
} catch {
continue
}
switch (colOptions.type) { switch (colOptions.type) {
case RelationTypes.BELONGS_TO: case RelationTypes.BELONGS_TO:
{ {
@ -2628,7 +2632,7 @@ class BaseModelSqlv2 {
await Promise.all(postInsertOps.map((f) => f())); await Promise.all(postInsertOps.map((f) => f()));
response = this.readByPk( response = this.readByPk(
rowId, rowId,
false, false,
{}, {},

Loading…
Cancel
Save