Skip to content

Commit

Permalink
only abort the upload and log the event if the upload has been created
Browse files Browse the repository at this point in the history
  • Loading branch information
becky-gilbert committed Aug 20, 2024
1 parent 34f4c18 commit ea3b4ae
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/data/src/lookitS3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,17 @@ class LookitS3 {
public async abortUpload() {
this.blobParts = [];
this.promises = [];
const input = {
Bucket: this.bucket,
Key: this.key,
UploadId: this.uploadId,
};
const command = new AbortMultipartUploadCommand(input);
await this.s3.send(command);
this.logRecordingEvent(`Upload aborted: ${this.key}`);
if (this.uploadId !== "") {
const input = {
Bucket: this.bucket,
Key: this.key,
UploadId: this.uploadId,
};
const command = new AbortMultipartUploadCommand(input);
await this.s3.send(command);
this.logRecordingEvent(`Upload aborted: ${this.key}`);
}
this.s3.destroy();
}
}

Expand Down

0 comments on commit ea3b4ae

Please sign in to comment.