1
0
Fork 0
mirror of synced 2024-10-05 20:44:47 +13:00

Merge pull request #13397 from Budibase/BUDI-8122/dont-persist-url-on-singleattachment

Clean and populate url for single attachment
This commit is contained in:
Adria Navarro 2024-04-03 17:16:54 +02:00 committed by GitHub
commit dc18b55c3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 1 deletions

View file

@ -155,6 +155,11 @@ export async function inputProcessing(
delete attachment.url
})
}
} else if (field.type === FieldType.ATTACHMENT_SINGLE) {
const attachment = clonedRow[key]
if (attachment?.url) {
delete clonedRow[key].url
}
}
if (field.type === FieldType.BB_REFERENCE && value) {
@ -227,6 +232,16 @@ export async function outputProcessing<T extends Row[] | Row>(
}
})
}
} else if (column.type === FieldType.ATTACHMENT_SINGLE) {
for (let row of enriched) {
if (!row[property]) {
continue
}
if (!row[property].url) {
row[property].url = objectStore.getAppFileUrl(row[property].key)
}
}
} else if (
!opts.skipBBReferences &&
column.type == FieldType.BB_REFERENCE

View file

@ -54,7 +54,7 @@ export function validate(rows: Rows, schema: TableSchema): ValidationResults {
type: columnType,
subtype: columnSubtype,
autocolumn: isAutoColumn,
} = schema[columnName]
} = schema[columnName] || {}
// If the column had an invalid value we don't want to override it
if (results.schemaValidation[columnName] === false) {
@ -147,6 +147,12 @@ export function parse(rows: Rows, schema: TableSchema): Rows {
utils.unreachable(columnSubtype)
}
}
} else if (
(columnType === FieldType.ATTACHMENTS ||
columnType === FieldType.ATTACHMENT_SINGLE) &&
typeof columnData === "string"
) {
parsedRow[columnName] = parseCsvExport(columnData)
} else {
parsedRow[columnName] = columnData
}