File tree 3 files changed +7
-3
lines changed 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change
1
+ ```release-note:bug
2
+ compute: GetProjectFromRegionalSelfLink accepts projects with a colon in the name
3
+ ```
Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ func GetRegionFromRegionalSelfLink(selfLink string) string {
174
174
}
175
175
176
176
func GetProjectFromRegionalSelfLink (selfLink string ) string {
177
- re := regexp .MustCompile ("projects/([a-zA-Z0-9-]*)/(?:locations|regions)/[a-zA-Z0-9-]*" )
177
+ re := regexp .MustCompile ("projects/([a-zA-Z0-9-: ]*)/(?:locations|regions)/[a-zA-Z0-9-: ]*" )
178
178
switch {
179
179
case re .MatchString (selfLink ):
180
180
if res := re .FindStringSubmatch (selfLink ); len (res ) == 2 && res [1 ] != "" {
Original file line number Diff line number Diff line change @@ -127,8 +127,9 @@ func TestGetRegionFromRegionalSelfLink(t *testing.T) {
127
127
128
128
func TestGetProjectFromRegionalSelfLink (t * testing.T ) {
129
129
cases := map [string ]string {
130
- "projects/foo/locations/europe-north1/datasets/bar/operations/foobar" : "foo" ,
131
- "projects/REDACTED/regions/europe-north1/subnetworks/tf-test-net-xbwhsmlfm8" : "REDACTED" ,
130
+ "projects/foo/locations/europe-north1/datasets/bar/operations/foobar" : "foo" ,
131
+ "projects/REDACTED/regions/europe-north1/subnetworks/tf-test-net-xbwhsmlfm8" : "REDACTED" ,
132
+ "projects/REDA:CT-ED09/regions/europe-north1/subnetworks/tf-test-net-xbwhsmlfm8" : "REDA:CT-ED09" ,
132
133
}
133
134
for input , expected := range cases {
134
135
if result := GetProjectFromRegionalSelfLink (input ); result != expected {
You can’t perform that action at this time.
0 commit comments