From b5ba4d5fefe1c4cdbe23bf81d3912b017399ff08 Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 13 Nov 2025 12:13:10 -0800 Subject: [PATCH] Simplify by removing the method-action mismatch path --- weed/s3api/s3_iam_middleware.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/weed/s3api/s3_iam_middleware.go b/weed/s3api/s3_iam_middleware.go index 001e139c6..958597915 100644 --- a/weed/s3api/s3_iam_middleware.go +++ b/weed/s3api/s3_iam_middleware.go @@ -257,18 +257,6 @@ func buildS3ResourceArn(bucket string, objectKey string) string { // NOTE: This function now uses the shared ResolveS3Action utility with additional // fallback logic for IAM-specific cases. func determineGranularS3Action(r *http.Request, fallbackAction Action, bucket string, objectKey string) string { - query := r.URL.Query() - - // IAM-specific: Check if there are specific query parameters indicating granular operations - // If there are, always use granular mapping regardless of method-action alignment - hasGranularIndicators := hasSpecificQueryParameters(query) - - // Only check for method-action mismatch when there are NO granular indicators - // This provides fallback behavior for cases where HTTP method doesn't align with intended action - if !hasGranularIndicators && isMethodActionMismatch(r.Method, fallbackAction) { - return mapLegacyActionToIAM(fallbackAction) - } - // Use the shared action resolver for consistent resolution across all S3 operations // ResolveS3Action handles all query parameters, HTTP methods, and object/bucket distinctions if resolvedAction := ResolveS3Action(r, string(fallbackAction), bucket, objectKey); resolvedAction != "" {