From 8df2ee9ee8a46acce58dcbd186cb34426dcbe770 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 22 Jan 2024 19:06:28 -0500 Subject: [PATCH] fix: we need to manually delete both the uploaded buffer file and the metafile --- storage/storage.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/storage/storage.go b/storage/storage.go index 8874ff3..c111d02 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -14,6 +14,7 @@ import ( "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/credentials" "github.com/aws/aws-sdk-go-v2/service/s3" + s3types "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/go-co-op/gocron/v2" "github.com/google/uuid" "github.com/imroc/req/v3" @@ -542,11 +543,20 @@ func (s *StorageServiceImpl) buildNewTusUploadTask(upload *models.TusUpload) (jo } s3InfoId, _ := splitS3Ids(upload.UploadID) - s3InfoId = s3InfoId + ".info" - _, err = s.s3Client.DeleteObject(ctx, &s3.DeleteObjectInput{ + _, err = s.s3Client.DeleteObjects(ctx, &s3.DeleteObjectsInput{ Bucket: aws.String(s.portal.Config().GetString("core.storage.s3.bufferBucket")), - Key: aws.String(s3InfoId), + Delete: &s3types.Delete{ + Objects: []s3types.ObjectIdentifier{ + { + Key: aws.String(s3InfoId), + }, + { + Key: aws.String(s3InfoId + ".info"), + }, + }, + Quiet: aws.Bool(true), + }, }) if err != nil {