File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Expand file tree Collapse file tree 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 {
174174}
175175
176176func 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-: ]*" )
178178 switch {
179179 case re .MatchString (selfLink ):
180180 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) {
127127
128128func TestGetProjectFromRegionalSelfLink (t * testing.T ) {
129129 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" ,
132133 }
133134 for input , expected := range cases {
134135 if result := GetProjectFromRegionalSelfLink (input ); result != expected {
You can’t perform that action at this time.
0 commit comments