add less than expected chunk count check
This commit is contained in:
parent
393831625b
commit
1bc67538eb
|
@ -23,7 +23,7 @@ export async function getFileHash(worker, file: File | ElectronFile) {
|
|||
for (let i = 0; i < filedata.chunkCount; i++) {
|
||||
const { done, value: chunk } = await streamReader.read();
|
||||
if (done) {
|
||||
break;
|
||||
throw Error(CustomError.CHUNK_LESS_THAN_EXPECTED);
|
||||
}
|
||||
await worker.hashFileChunk(hashState, Uint8Array.from(chunk));
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ export enum CustomError {
|
|||
KEY_MISSING = 'encrypted key missing from localStorage',
|
||||
FAILED_TO_LOAD_WEB_WORKER = 'failed to load web worker',
|
||||
CHUNK_MORE_THAN_EXPECTED = 'chunks more than expected',
|
||||
CHUNK_LESS_THAN_EXPECTED = 'chunks less than expected',
|
||||
UNSUPPORTED_FILE_FORMAT = 'unsupported file formats',
|
||||
FILE_TOO_LARGE = 'file too large',
|
||||
SUBSCRIPTION_EXPIRED = 'subscription expired',
|
||||
|
|
Loading…
Reference in a new issue