@@ -45,12 +45,14 @@ var unsupportedS3Props = []string{
4545
4646// ParseAWSConfig parses S3 properties and returns a configuration.
4747func ParseAWSConfig (ctx context.Context , props map [string ]string ) (* aws.Config , error ) {
48+ // If any unsupported properties are set, return an error.
4849 for k := range props {
4950 if slices .Contains (unsupportedS3Props , k ) {
5051 return nil , fmt .Errorf ("unsupported S3 property %q" , k )
5152 }
5253 }
5354
55+ // Remote S3 request signing is not implemented yet.
5456 if v , ok := props [io .S3RemoteSigningEnabled ]; ok {
5557 if enabled , err := strconv .ParseBool (v ); err == nil && enabled {
5658 return nil , errors .New ("remote S3 request signing is not supported" )
@@ -100,15 +102,18 @@ func ParseAWSConfig(ctx context.Context, props map[string]string) (*aws.Config,
100102 return awscfg , nil
101103}
102104
103- // resolveUsePathStyle determines whether the S3 client should use path-style addressing.
104- // It defaults to virtual-hosted style for standard AWS S3 and path-style for custom endpoints.
105+ // resolveUsePathStyle determines whether the S3 client should use
106+ // path-style addressing. It defaults to virtual-hosted style for
107+ // standard AWS S3 and path-style for custom endpoints (e.g. MinIO).
108+ // The s3.force-virtual-addressing property can override either default.
105109func resolveUsePathStyle (endpoint string , props map [string ]string ) bool {
106110 usePathStyle := endpoint != ""
107111 if forceVirtual , ok := props [io .S3ForceVirtualAddressing ]; ok {
108112 if cfgForceVirtual , err := strconv .ParseBool (forceVirtual ); err == nil {
109113 usePathStyle = ! cfgForceVirtual
110114 }
111115 }
116+
112117 return usePathStyle
113118}
114119
@@ -139,6 +144,7 @@ func createS3Bucket(ctx context.Context, parsed *url.URL, props map[string]strin
139144 o .DisableLogOutputChecksumValidationSkipped = true
140145 })
141146
147+ // Create a *blob.Bucket.
142148 bucket , err := s3blob .OpenBucketV2 (ctx , client , parsed .Host , nil )
143149 if err != nil {
144150 return nil , err
0 commit comments