From 0bc3a73d89717977cc1489b2e0be38f926b9c2f1 Mon Sep 17 00:00:00 2001 From: chrislu Date: Wed, 12 Nov 2025 23:04:13 -0800 Subject: [PATCH] fix doc --- weed/s3api/policy_conversion.go | 5 +++-- weed/s3api/s3api_bucket_policy_engine.go | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/weed/s3api/policy_conversion.go b/weed/s3api/policy_conversion.go index 2d557f960..0ae7d5306 100644 --- a/weed/s3api/policy_conversion.go +++ b/weed/s3api/policy_conversion.go @@ -9,10 +9,11 @@ import ( ) // ConvertPolicyDocumentToPolicyEngine converts a policy.PolicyDocument to policy_engine.PolicyDocument -// This function provides efficient type conversion without JSON marshaling overhead. +// This function provides type-safe conversion with explicit field mapping and error handling. // It handles the differences between the two types: // - Converts []string fields to StringOrStringSlice -// - Maps Condition types +// - Maps Condition types with type validation +// - Converts Principal fields with support for AWS principals only // - Handles optional fields (Id, NotPrincipal, NotAction, NotResource are ignored in policy_engine) // // Returns an error if the policy contains unsupported types or malformed data. diff --git a/weed/s3api/s3api_bucket_policy_engine.go b/weed/s3api/s3api_bucket_policy_engine.go index c306332fe..54b43223e 100644 --- a/weed/s3api/s3api_bucket_policy_engine.go +++ b/weed/s3api/s3api_bucket_policy_engine.go @@ -49,8 +49,8 @@ func (bpe *BucketPolicyEngine) LoadBucketPolicy(bucket string, entry *filer_pb.E // LoadBucketPolicyFromCache loads a bucket policy from a cached BucketConfig // -// This function uses a direct conversion function to efficiently convert between -// policy.PolicyDocument and policy_engine.PolicyDocument without JSON marshaling overhead. +// This function uses a type-safe conversion function to convert between +// policy.PolicyDocument and policy_engine.PolicyDocument with explicit field mapping and error handling. func (bpe *BucketPolicyEngine) LoadBucketPolicyFromCache(bucket string, policyDoc *policy.PolicyDocument) error { if policyDoc == nil { // No policy for this bucket - remove it if it exists