Skip to content

Commit

Permalink
config/types: Add validation for gcs urls
Browse files Browse the repository at this point in the history
  • Loading branch information
sohankunkerkar committed Jun 16, 2020
1 parent 5d55fc5 commit def568e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/v3_0/types/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func validateURL(s string) error {
}

switch u.Scheme {
case "http", "https", "tftp":
case "http", "https", "tftp", "gs":
return nil
case "s3":
if v, ok := u.Query()["versionId"]; ok {
Expand Down
4 changes: 4 additions & 0 deletions config/v3_0/types/url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func TestURLValidate(t *testing.T) {
util.StrToPtr("s3://bucket/key?versionId=aVersionHash"),
nil,
},
{
util.StrToPtr("gs://bucket/object"),
nil,
},
}

for i, test := range tests {
Expand Down
2 changes: 1 addition & 1 deletion config/v3_1/types/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func validateURL(s string) error {
}

switch u.Scheme {
case "http", "https", "tftp":
case "http", "https", "tftp", "gs":
return nil
case "s3":
if v, ok := u.Query()["versionId"]; ok {
Expand Down
4 changes: 4 additions & 0 deletions config/v3_1/types/url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func TestURLValidate(t *testing.T) {
util.StrToPtr("s3://bucket/key?versionId=aVersionHash"),
nil,
},
{
util.StrToPtr("gs://bucket/object"),
nil,
},
}

for i, test := range tests {
Expand Down
2 changes: 1 addition & 1 deletion config/v3_2_experimental/types/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func validateURL(s string) error {
}

switch u.Scheme {
case "http", "https", "tftp":
case "http", "https", "tftp", "gs":
return nil
case "s3":
if v, ok := u.Query()["versionId"]; ok {
Expand Down
4 changes: 4 additions & 0 deletions config/v3_2_experimental/types/url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func TestURLValidate(t *testing.T) {
util.StrToPtr("s3://bucket/key?versionId=aVersionHash"),
nil,
},
{
util.StrToPtr("gs://bucket/object"),
nil,
},
}

for i, test := range tests {
Expand Down

0 comments on commit def568e

Please sign in to comment.