1
0
mirror of https://github.com/distribution/distribution synced 2024-12-25 15:05:51 +01:00

fix logic for handling regionEndpoint (#4341)

This commit is contained in:
Milos Gajdos 2024-07-18 22:56:58 +01:00 committed by GitHub
commit 252619876a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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)
}