From 4d4463afca762adf38d0e4ff9a91dca5605fa5d5 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 14 Jul 2025 23:21:42 -0700 Subject: [PATCH] Update weed/s3api/s3api_bucket_config.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- weed/s3api/s3api_bucket_config.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/weed/s3api/s3api_bucket_config.go b/weed/s3api/s3api_bucket_config.go index df13f3ab9..c0415ce0b 100644 --- a/weed/s3api/s3api_bucket_config.go +++ b/weed/s3api/s3api_bucket_config.go @@ -124,7 +124,15 @@ func (s3a *S3ApiServer) getBucketConfig(bucket string) (*BucketConfig, s3err.Err } // Load CORS configuration from .s3metadata - if corsConfig, err := s3a.loadCORSFromMetadata(bucket); err == nil { + if corsConfig, err := s3a.loadCORSFromMetadata(bucket); err != nil { + if err == filer_pb.ErrNotFound { + // Missing metadata is not an error; fall back cleanly + glog.V(2).Infof("CORS metadata not found for bucket %s, falling back to default behavior", bucket) + } else { + // Log parsing or validation errors + glog.Errorf("Failed to load CORS configuration for bucket %s: %v", bucket, err) + } + } else { config.CORS = corsConfig }