diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 6341018859..8857b6bc29 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -4000,7 +4000,7 @@ class BaseModelSqlv2 { : await this.dbDriver.raw(query); // update attachment fields - data = this.convertAttachmentType(data, childTable); + data = await this.convertAttachmentType(data, childTable); // update date time fields data = this.convertDateFormat(data, childTable); @@ -4024,7 +4024,16 @@ class BaseModelSqlv2 { return d; } - public convertAttachmentType(data: Record, childTable?: Model) { + public async convertAttachmentType( + data: Record, + childTable?: Model, + ) { + if (childTable && !childTable?.columns) { + await childTable.getColumns(); + } else if (!this.model?.columns) { + await this.model.getColumns(); + } + // attachment is stored in text and parse in UI // convertAttachmentType is used to convert the response in string to array of object in API response if (data) {