From 7a0b44c2752015cf6140c17ff3821e1dd1ce60d1 Mon Sep 17 00:00:00 2001 From: DualFroz Date: Fri, 2 Oct 2026 16:40:10 +0200 Subject: [PATCH] fix: drop upload-id-marker without key-marker in ListMultipartUploads An upload-id-marker sent without a key-marker is ignored for the listing, but the gateway still echoed it back in UploadIdMarker. S3 discards the parameter in that case and returns an empty UploadIdMarker. Clear the marker in the controller when no key-marker is given, so every backend gets the same input and the response no longer reports a marker that had no effect. Fixes #2150 --- s3api/controllers/bucket-get.go | 5 +++++ tests/integration/ListMultipartUploads.go | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/s3api/controllers/bucket-get.go b/s3api/controllers/bucket-get.go index 0399c9a..4340a75 100644 --- a/s3api/controllers/bucket-get.go +++ b/s3api/controllers/bucket-get.go @@ -472,6 +472,11 @@ func (c S3ApiController) ListMultipartUploads(ctx fiber.Ctx) (*Response, error) keyMarker := ctx.Query("key-marker") maxUploadsStr := ctx.Query("max-uploads") uploadIdMarker := ctx.Query("upload-id-marker") + // upload-id-marker is ignored without a key-marker, + // so it shouldn't be echoed back in the response either + if keyMarker == "" { + uploadIdMarker = "" + } // context keys acct := utils.ContextKeyAccount.Get(ctx).(auth.Account) isRoot := utils.ContextKeyIsRoot.Get(ctx).(bool) diff --git a/tests/integration/ListMultipartUploads.go b/tests/integration/ListMultipartUploads.go index f163875..136e15d 100644 --- a/tests/integration/ListMultipartUploads.go +++ b/tests/integration/ListMultipartUploads.go @@ -206,6 +206,9 @@ func ListMultipartUploads_ignore_upload_id_marker(s *S3Conf) error { return fmt.Errorf("expected multipart uploads to be %v, instead got %v", uploads, out.Uploads) } + if getString(out.UploadIdMarker) != "" { + return fmt.Errorf("expected empty upload id marker, instead got %s", getString(out.UploadIdMarker)) + } // should ignore invalid uploaId marker ctx, cancel = context.WithTimeout(context.Background(), shortTimeout) @@ -221,6 +224,9 @@ func ListMultipartUploads_ignore_upload_id_marker(s *S3Conf) error { return fmt.Errorf("expected multipart uploads to be %v, instead got %v", uploads, out.Uploads) } + if getString(out.UploadIdMarker) != "" { + return fmt.Errorf("expected empty upload id marker, instead got %s", getString(out.UploadIdMarker)) + } return nil })