qfix: pass file uuid to uppy metadata (#6985)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-10-18 22:48:23 +07:00 committed by GitHub
parent bad07b90fc
commit c0021bbe7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -128,8 +128,11 @@ export function getUppy (options: FileUploadOptions): Uppy<UppyMeta, UppyBody> {
uppy.addPreProcessor(async (fileIds: string[]) => {
for (const fileId of fileIds) {
const file = uppy.getFile(fileId)
if (file != null && file.meta.uuid === undefined) {
uppy.setFileMeta(fileId, { uuid: generateFileId() })
if (file != null) {
// It may seem weird that we modify file name here
// but we need a way to pass file UUID to Datalake via form data
const uuid = file.meta.uuid ?? generateFileId()
uppy.setFileMeta(fileId, { uuid, name: uuid })
}
}
})