mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-23 14:39:40 -05:00
operator: escape dots in url (#2990)
This commit is contained in:
parent
c40e1a9bbd
commit
0b13c5bca9
@ -14,8 +14,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
diskSourceRegex = regexp.MustCompile(`^https://www.googleapis.com/compute/v1/projects/([^/]+)/zones/([^/]+)/disks/([^/]+)$`)
|
||||
computeAPIBase = regexp.MustCompile(`^https://www.googleapis.com/compute/v1/(.+)$`)
|
||||
diskSourceRegex = regexp.MustCompile(`^https://www\.googleapis\.com/compute/v1/projects/([^/]+)/zones/([^/]+)/disks/([^/]+)$`)
|
||||
computeAPIBase = regexp.MustCompile(`^https://www\.googleapis\.com/compute/v1/(.+)$`)
|
||||
)
|
||||
|
||||
// diskSourceToDiskReq converts a disk source URI to a disk request.
|
||||
|
@ -36,6 +36,10 @@ func TestDiskSourceToDiskReq(t *testing.T) {
|
||||
diskSource: "invalid://www.googleapis.com/compute/v1/projects/project/zones/zone/disks/disk",
|
||||
wantErr: true,
|
||||
},
|
||||
"url dots in regex are escaped": {
|
||||
diskSource: "https://wwwAgoogleapisAcom/compute/v1/projects/project/zones/zone/disks/disk",
|
||||
wantErr: true,
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range testCases {
|
||||
@ -67,6 +71,10 @@ func TestURINormalize(t *testing.T) {
|
||||
imageURI: "projects/project/global/images/image",
|
||||
wantNormalized: "projects/project/global/images/image",
|
||||
},
|
||||
"url dots in regex are escaped": {
|
||||
imageURI: "https://wwwAgoogleapisAcom/compute/v1/projects/project/global/images/image",
|
||||
wantNormalized: "https://wwwAgoogleapisAcom/compute/v1/projects/project/global/images/image",
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range testCases {
|
||||
|
Loading…
Reference in New Issue
Block a user