Skip to content

Commit

Permalink
fix logic for handling regionEndpoint
Browse files Browse the repository at this point in the history
With the current logic we only verifies the region and return if it's
empty; we were not validating the regionEndpoint parameter.

Signed-off-by: Ankur Kothiwal <ankur.kothiwal@cern.com>
  • Loading branch information
Ankur Kothiwal committed May 7, 2024
1 parent c49220d commit eb6123f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions registry/storage/driver/s3-aws/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,13 @@ func FromParameters(ctx context.Context, parameters map[string]interface{}) (*Dr
}

regionName := parameters["region"]
if regionName == nil || fmt.Sprint(regionName) == "" {
return nil, fmt.Errorf("no region parameter provided")
}
region := fmt.Sprint(regionName)

// Don't check the region value if a custom endpoint is provided.
if regionEndpoint == "" {
if regionName == nil || region == "" {
return nil, fmt.Errorf("no region parameter provided")
}
if _, ok := validRegions[region]; !ok {
return nil, fmt.Errorf("invalid region provided: %v", region)
}
Expand Down

0 comments on commit eb6123f

Please sign in to comment.