diff --git a/lib/utils/upload.ts b/lib/utils/upload.ts index 259f111f..6e6ee402 100644 --- a/lib/utils/upload.ts +++ b/lib/utils/upload.ts @@ -62,6 +62,10 @@ export const uploadData = async function( * garbage collection */ export const getChunk = function(file: File, start: number, length: number): Promise { + if (file.size <= start + length) { + return Promise.resolve(new Blob([file], { type: file.type })) + } + // Since we use a global FileReader, we need to only read one chunk at a time return readerLimit(() => new Promise((resolve, reject) => { reader.onload = () => {