@@ -135,6 +135,11 @@ const Scheme = "s3"
135
135
// - kmskeyid: The KMS key ID for server side encryption
136
136
// - accelerate: A value of "true" uses the S3 Transfer Accleration endpoints
137
137
//
138
+ // V2 additionally supports:
139
+ // - use_path_style: A value of true sets the UsePathStyle option.
140
+ // - s3ForcePathStyle: Same as use_path_style, for backwards compatibility with V1.
141
+ // - disable_https: A value of true disables HTTPS in the Endpoint options.
142
+ //
138
143
// For V1, see gocloud.dev/aws/ConfigFromURLParams for supported query parameters
139
144
// for overriding the aws.Session from the URL.
140
145
// For V2, see gocloud.dev/aws/V2ConfigFromURLParams.
@@ -150,11 +155,12 @@ type URLOpener struct {
150
155
}
151
156
152
157
const (
153
- sseTypeParamKey = "ssetype"
154
- kmsKeyIdParamKey = "kmskeyid"
155
- accelerateParamKey = "accelerate"
156
- usePathStyleParamkey = "use_path_style"
157
- disableHTTPSParamKey = "disable_https"
158
+ sseTypeParamKey = "ssetype"
159
+ kmsKeyIdParamKey = "kmskeyid"
160
+ accelerateParamKey = "accelerate"
161
+ usePathStyleParamKey = "use_path_style"
162
+ legacyUsePathStyleParamKey = "s3ForcePathStyle" // for backwards compatibility
163
+ disableHTTPSParamKey = "disable_https"
158
164
)
159
165
160
166
func toServerSideEncryptionType (value string ) (typesv2.ServerSideEncryption , error ) {
@@ -212,15 +218,17 @@ func (o *URLOpener) OpenBucketURL(ctx context.Context, u *url.URL) (*blob.Bucket
212
218
o .EndpointOptions .DisableHTTPS = value
213
219
})
214
220
}
215
- if usePathStyleParam := q .Get (usePathStyleParamkey ); usePathStyleParam != "" {
216
- q .Del (usePathStyleParamkey )
217
- value , err := strconv .ParseBool (usePathStyleParam )
218
- if err != nil {
219
- return nil , fmt .Errorf ("invalid value for %q: %v" , usePathStyleParamkey , err )
221
+ for _ , key := range []string {usePathStyleParamKey , legacyUsePathStyleParamKey } {
222
+ if usePathStyleParam := q .Get (key ); usePathStyleParam != "" {
223
+ q .Del (key )
224
+ value , err := strconv .ParseBool (usePathStyleParam )
225
+ if err != nil {
226
+ return nil , fmt .Errorf ("invalid value for %q: %v" , key , err )
227
+ }
228
+ opts = append (opts , func (o * s3v2.Options ) {
229
+ o .UsePathStyle = value
230
+ })
220
231
}
221
- opts = append (opts , func (o * s3v2.Options ) {
222
- o .UsePathStyle = value
223
- })
224
232
}
225
233
226
234
cfg , err := gcaws .V2ConfigFromURLParams (ctx , q )
0 commit comments