Browse Source

fix: parse attachment column value if string

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4495/head
Pranav C 2 years ago
parent
commit
3882bd1692
  1. 7
      packages/nc-gui/components/smartsheet/Gallery.vue
  2. 7
      packages/nc-gui/components/smartsheet/Kanban.vue

7
packages/nc-gui/components/smartsheet/Gallery.vue

@ -80,7 +80,12 @@ const isRowEmpty = (record: any, col: any) => {
const attachments = (record: any): Attachment[] => {
try {
return coverImageColumn?.title && record.row[coverImageColumn.title] ? JSON.parse(record.row[coverImageColumn.title]) : []
if (coverImageColumn?.title && record.row[coverImageColumn.title]) {
return typeof record.row[coverImageColumn.title] === 'string'
? JSON.parse(record.row[coverImageColumn.title])
: record.row[coverImageColumn.title]
}
return []
} catch (e) {
return []
}

7
packages/nc-gui/components/smartsheet/Kanban.vue

@ -116,7 +116,12 @@ reloadViewDataHook?.on(async () => {
const attachments = (record: any): Attachment[] => {
try {
return coverImageColumn?.title && record.row[coverImageColumn.title] ? JSON.parse(record.row[coverImageColumn.title]) : []
if (coverImageColumn?.title && record.row[coverImageColumn.title]) {
return typeof record.row[coverImageColumn.title] === 'string'
? JSON.parse(record.row[coverImageColumn.title])
: record.row[coverImageColumn.title]
}
return []
} catch (e) {
return []
}

Loading…
Cancel
Save