Skip to content

Commit

Permalink
Fix: S3 remove not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Vija02 committed Dec 29, 2024
1 parent 872bb35 commit ae0f996
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion backend/backend-shared/src/media/s3/OurS3Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,31 @@ export class OurS3Store extends S3Store {
}

public async remove(id: string): Promise<void> {
await super.remove(id);
const { "upload-id": uploadId } = await this.getMetadata(id);
if (uploadId) {
await this.client
.abortMultipartUpload({
Bucket: this.bucket,
Key: id,
UploadId: uploadId,
})
.catch(() => {
/* ignore */
});
}

await this.client
.deleteObject({
Bucket: this.bucket,
Key: id,
})
.catch(() => {
/* ignore */
});

await fsProm.rm(this.getIncompletePartPath(id)).catch(() => {
/* ignore */
});

const splittedKey = id.split(".");
const mediaId = splittedKey[0];
Expand Down

0 comments on commit ae0f996

Please sign in to comment.