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
This commit is contained in:
1 parent
79e4cf7bca
commit
7a0b44c275
2 files changed
+11
No files matched your search
@@ -472,6 +472,11 @@ func (c S3ApiController) ListMultipartUploads(ctx fiber.Ctx) (*Response, error)
|
|||||||
keyMarker := ctx.Query("key-marker")
|
keyMarker := ctx.Query("key-marker")
|
||||||
maxUploadsStr := ctx.Query("max-uploads")
|
maxUploadsStr := ctx.Query("max-uploads")
|
||||||
uploadIdMarker := ctx.Query("upload-id-marker")
|
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
|
// context keys
|
||||||
acct := utils.ContextKeyAccount.Get(ctx).(auth.Account)
|
acct := utils.ContextKeyAccount.Get(ctx).(auth.Account)
|
||||||
isRoot := utils.ContextKeyIsRoot.Get(ctx).(bool)
|
isRoot := utils.ContextKeyIsRoot.Get(ctx).(bool)
|
||||||
|
|||||||
@@ -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",
|
return fmt.Errorf("expected multipart uploads to be %v, instead got %v",
|
||||||
uploads, out.Uploads)
|
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
|
// should ignore invalid uploaId marker
|
||||||
ctx, cancel = context.WithTimeout(context.Background(), shortTimeout)
|
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",
|
return fmt.Errorf("expected multipart uploads to be %v, instead got %v",
|
||||||
uploads, out.Uploads)
|
uploads, out.Uploads)
|
||||||
}
|
}
|
||||||
|
if getString(out.UploadIdMarker) != "" {
|
||||||
|
return fmt.Errorf("expected empty upload id marker, instead got %s", getString(out.UploadIdMarker))
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user