fix logic for handling regionEndpoint
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>
This commit is contained in:
parent
c49220d492
commit
eb6123f5ed
1 changed files with 4 additions and 3 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue