Browse Source

fix(nocodb): convert attachment val to string before insert/update

pull/4987/head
Wing-Kam Wong 2 years ago
parent
commit
3a41cf5ee6
  1. 5
      packages/nocodb/src/lib/models/Model.ts

5
packages/nocodb/src/lib/models/Model.ts

@ -441,11 +441,14 @@ export default class Model implements TableType {
const insertObj = {};
for (const col of await this.getColumns()) {
if (isVirtualCol(col)) continue;
const val =
let val =
data?.[col.column_name] !== undefined
? data?.[col.column_name]
: data?.[col.title];
if (val !== undefined) {
if (col.uidt === UITypes.Attachment && typeof val !== 'string') {
val = JSON.stringify(val);
}
insertObj[sanitize(col.column_name)] = val;
}
}

Loading…
Cancel
Save