From db314a4ef3dc7cce9c46eff94b747039f011fa06 Mon Sep 17 00:00:00 2001 From: Christophe Vu-Brugier Date: Wed, 12 Jun 2024 14:58:05 +0200 Subject: [PATCH] fix: fix removal of the upload directory in posix CompleteMultipartUpload In the posix backend, the path argument to os.RemoveAll() does not start with the bucket name. Since the path does not exist, os.RemoveAll() does nothing and uploaded parts are left in the ".sgwtmp" directory. This commit prefixes the path with the bucket name. Fixes issue #626. Signed-off-by: Christophe Vu-Brugier --- backend/posix/posix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/posix/posix.go b/backend/posix/posix.go index 9060de8a..59b97d49 100644 --- a/backend/posix/posix.go +++ b/backend/posix/posix.go @@ -656,7 +656,7 @@ func (p *Posix) CompleteMultipartUpload(ctx context.Context, input *s3.CompleteM } // cleanup tmp dirs - os.RemoveAll(upiddir) + os.RemoveAll(filepath.Join(bucket, objdir, uploadID)) // use Remove for objdir in case there are still other uploads // for same object name outstanding, this will fail if there are os.Remove(filepath.Join(bucket, objdir))