diff --git a/packages/nc-gui/components/cell/attachment/utils.ts b/packages/nc-gui/components/cell/attachment/utils.ts index 9d8bbd5b41..baafb5f9f7 100644 --- a/packages/nc-gui/components/cell/attachment/utils.ts +++ b/packages/nc-gui/components/cell/attachment/utils.ts @@ -95,29 +95,26 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState( new Promise((resolve) => { const res: AttachmentProps = { ...file, file, title: file.name, mimetype: file.type } - renameFile(file).then((renamedFile) => { - if (isImage(renamedFile.name, (renamedFile).mimetype ?? renamedFile.type)) { - const reader = new FileReader() + if (isImage(file.name, (file).mimetype ?? file.type)) { + const reader = new FileReader() - reader.onload = (e) => { - res.data = e.target?.result + reader.onload = (e) => { + res.data = e.target?.result - resolve(res) - } - - reader.onerror = () => { - resolve(res) - } + resolve(res) + } - reader.readAsDataURL(file) - } else { + reader.onerror = () => { resolve(res) } - }) + + reader.readAsDataURL(file) + } else { + resolve(res) + } }), ), ) - attachments.value = [...attachments.value, ...newFiles] return updateModelValue(attachments.value) @@ -152,8 +149,6 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState( continue } - file = await renameFile(file) - files.push(file) }