Browse Source

feat(nc-gui): remove rename upon upload

pull/4931/head
Wing-Kam Wong 2 years ago
parent
commit
d8f8bda96b
  1. 29
      packages/nc-gui/components/cell/attachment/utils.ts

29
packages/nc-gui/components/cell/attachment/utils.ts

@ -95,29 +95,26 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState(
new Promise<AttachmentProps>((resolve) => {
const res: AttachmentProps = { ...file, file, title: file.name, mimetype: file.type }
renameFile(file).then((renamedFile) => {
if (isImage(renamedFile.name, (<any>renamedFile).mimetype ?? renamedFile.type)) {
const reader = new FileReader()
if (isImage(file.name, (<any>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)
}

Loading…
Cancel
Save