fix: Fixed error when trying to upload file

This commit is contained in:
Aman Harwara
2022-12-07 00:42:03 +05:30
parent 3d8c12a789
commit 6a1b6cef1b

View File

@@ -357,12 +357,17 @@ export class FilesController extends AbstractViewController<FilesControllerEvent
try {
const minimumChunkSize = this.application.files.minimumChunkSize()
if (fileOrHandle instanceof FileSystemFileHandle && !this.shouldUseStreamingReader) {
const fileToUpload =
fileOrHandle instanceof File
? fileOrHandle
: fileOrHandle instanceof FileSystemFileHandle && this.shouldUseStreamingReader
? await fileOrHandle.getFile()
: undefined
if (!fileToUpload) {
return
}
const fileToUpload = fileOrHandle instanceof File ? fileOrHandle : await fileOrHandle.getFile()
if (this.alertIfFileExceedsSizeLimit(fileToUpload)) {
return
}