Skip to content

Commit 68b13c9

Browse files
committed
fix(progressive upload): throw on mergeSmallPartsBeforeUpload = false && file size < 5MB
1 parent cca3499 commit 68b13c9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/progressive-video-uploader.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ export class ProgressiveUploader extends AbstractUploader<ProgressiveProgressEve
3737
}
3838

3939
public uploadPart(file: Blob): Promise<void> {
40+
if (!this.mergeSmallPartsBeforeUpload && file.size < MIN_CHUNK_SIZE) {
41+
throw new Error(`Each part must have a minimal size of 5MB. The current part has a size of ${this.currentPartBlobsSize / 1024 / 1024}MB.`)
42+
}
4043
this.currentPartBlobsSize += file.size;
4144
this.currentPartBlobs.push(file);
4245

4346
if ((this.preventEmptyParts && (this.currentPartBlobsSize - file.size >= MIN_CHUNK_SIZE))
4447
|| (!this.preventEmptyParts && (this.currentPartBlobsSize >= MIN_CHUNK_SIZE))
4548
|| (!this.mergeSmallPartsBeforeUpload)) {
4649

47-
if (!this.mergeSmallPartsBeforeUpload && this.currentPartBlobsSize < MIN_CHUNK_SIZE) {
48-
throw new Error(`Each part must have a minimal size of 5MB. The current part has a size of ${this.currentPartBlobsSize / 1024 / 1024}MB.`)
49-
}
5050
let toSend: any[];
5151
if(this.preventEmptyParts) {
5252
toSend = this.currentPartBlobs.slice(0, -1);

0 commit comments

Comments
 (0)