Skip to content

Commit

Permalink
fix: uploading file with zero size
Browse files Browse the repository at this point in the history
  • Loading branch information
kukhariev committed Jul 19, 2019
1 parent 05210b7 commit d5538c7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/uploadx/src/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,16 @@ export abstract class Uploader implements UploadState {
while (this.status === 'uploading' || this.status === 'retry') {
try {
const offset = this.offset >= 0 ? await this.sendFileContent() : await this.getOffset();
if (offset >= this.size) {
this.offset = offset;
this.progress = 100;
this.status = 'complete';
}
if (offset === this.offset) {
throw new Error('Content upload failed');
}
this.retry.reset();
this.offset = offset;
if (this.offset >= this.size) {
this.progress = 100;
this.status = 'complete';
}
} catch {
if (this.isFatalError || this.isMaxAttemptsReached) {
this.status = 'error';
Expand Down

0 comments on commit d5538c7

Please sign in to comment.