chore: refresh compatibility and lint baselines

Accept the new CORS test routes, resident getter, and replication header literals in the rebrand guard. Apply gofumpt, context-first helper ordering, and spelling fixes required by CI.

Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
Feng Ruohang
2026-09-02 02:31:20 +08:00
parent ab3ae99ca3
commit 04b097fd9f
5 changed files with 22 additions and 9 deletions
+2 -2
View File
@@ -495,7 +495,7 @@ func requireCorsOriginVary(t *testing.T, header http.Header) {
}
// markBucketMetadataInitialized marks the global bucket-metadata subsystem as
// fully loaded, modelling a running server (the API test harness sets up the
// fully loaded, modeling a running server (the API test harness sets up the
// subsystem but does not run Init). It returns a function that restores the
// previous state.
func markBucketMetadataInitialized(t *testing.T) func() {
@@ -637,7 +637,7 @@ func testBucketCorsStartupMissFailsClosedWithoutIO(obj ObjectLayer, _ string, _
}
// markBucketMetadataLoadFailed records a bucket as one whose metadata failed to
// load at startup while the subsystem is Initialized, modelling the degraded
// load at startup while the subsystem is Initialized, modeling the degraded
// state where a real bucket is not resident. Returns a restore function.
func markBucketMetadataLoadFailed(t *testing.T, bucket string) func() {
t.Helper()
+1 -1
View File
@@ -325,7 +325,7 @@ func TestCloneRequestWithoutReplicationHeaders(t *testing.T) {
req.Header.Set("X-Minio-Replication-Server-Side-Encryption-Sealed-Key", "sealed")
req.Header.Set("Content-Type", "application/octet-stream")
clone := cloneRequestWithoutReplicationHeaders(req, t.Context())
clone := cloneRequestWithoutReplicationHeaders(t.Context(), req)
if clone == req {
t.Fatal("expected cloned request")
}
+2 -2
View File
@@ -2522,7 +2522,7 @@ func (api objectAPIHandlers) PutObjectExtractHandler(w http.ResponseWriter, r *h
trustedRequestCtx := withReplicationTrust(ctx, true, rawReplica)
trustedRequest := entryRequestBase.WithContext(trustedRequestCtx)
cleanRequestCtx := withReplicationTrust(ctx, false, false)
cleanRequest := cloneRequestWithoutReplicationHeaders(entryRequestBase, cleanRequestCtx)
cleanRequest := cloneRequestWithoutReplicationHeaders(cleanRequestCtx, entryRequestBase)
trustedReqParams := extractReqParams(trustedRequest)
cleanReqParams := extractReqParams(cleanRequest)
@@ -2572,7 +2572,7 @@ func (api objectAPIHandlers) PutObjectExtractHandler(w http.ResponseWriter, r *h
entryTrusted := markerExact && replicationPermitted
replicaTrusted := entryTrusted && rawReplica
entryCtx := cleanRequestCtx
entryReq := cloneRequestWithoutReplicationHeaders(entryAuthReq, cleanRequestCtx)
entryReq := cloneRequestWithoutReplicationHeaders(cleanRequestCtx, entryAuthReq)
reqParams := cleanReqParams
if entryTrusted {
entryCtx = trustedRequestCtx
+6 -4
View File
@@ -20,8 +20,10 @@ import (
"github.com/minio/pkg/v3/policy"
)
type replicationTrustKey struct{}
type replicaTrustKey struct{}
type (
replicationTrustKey struct{}
replicaTrustKey struct{}
)
// hasReplicationMarker reports whether the internal replication marker has
// its one accepted wire value. Header presence alone is never a trust signal.
@@ -105,7 +107,7 @@ func hasReplicationRequestHeaders(h http.Header) bool {
return false
}
func cloneRequestWithoutReplicationHeaders(r *http.Request, ctx context.Context) *http.Request {
func cloneRequestWithoutReplicationHeaders(ctx context.Context, r *http.Request) *http.Request {
clone := r.Clone(ctx)
stripReplicationRequestHeaders(clone.Header)
return clone
@@ -119,5 +121,5 @@ func applyReplicationTrust(ctx context.Context, r *http.Request, trusted, replic
if trusted {
return ctx, r.WithContext(ctx)
}
return ctx, cloneRequestWithoutReplicationHeaders(r, ctx)
return ctx, cloneRequestWithoutReplicationHeaders(ctx, r)
}