Skip to content

Commit ab1363c

Browse files
fix(validation): zone and region patterns (scaleway#2748)
1 parent 65aa212 commit ab1363c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

scw/locality_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func TestParseZone(t *testing.T) {
6161
err: errors.New("bad zone format, available zones are: fr-par-1, fr-par-2, fr-par-3, nl-ams-1, nl-ams-2, nl-ams-3, pl-waw-1, pl-waw-2, pl-waw-3"),
6262
},
6363
{
64-
input: "fr-par-0",
64+
input: "fr-par-200",
6565
expected: "",
6666
err: errors.New("bad zone format, available zones are: fr-par-1, fr-par-2, fr-par-3, nl-ams-1, nl-ams-2, nl-ams-3, pl-waw-1, pl-waw-2, pl-waw-3"),
6767
},

validation/is.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88

99
var (
1010
isUUIDRegexp = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
11-
isRegionRegex = regexp.MustCompile("^[a-z]{2}-[a-z]{3}$")
12-
isZoneRegex = regexp.MustCompile("^[a-z]{2}-[a-z]{3}-[1-9]$")
11+
isRegionRegex = regexp.MustCompile("^[a-z]{2}-[a-z]{3,7}$")
12+
isZoneRegex = regexp.MustCompile("^[a-z]{2}-[a-z]{3,7}-[0-9]{1,2}$")
1313
isAccessKey = regexp.MustCompile("^SCW[A-Z0-9]{17}$")
1414
isEmailRegexp = regexp.MustCompile("^.+@.+$")
1515
)

0 commit comments

Comments
 (0)