Skip to content

Commit

Permalink
Merge pull request #7478 from xinyi-joffre/master
Browse files Browse the repository at this point in the history
Update path validation for azure_rm_api_management_api
  • Loading branch information
tombuildsstuff committed Jun 25, 2020
2 parents f73cc48 + f2189a9 commit 127eb47
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion azurerm/helpers/validate/api_management.go
Expand Up @@ -71,7 +71,7 @@ func ApiManagementApiName(v interface{}, k string) (ws []string, es []error) {
func ApiManagementApiPath(v interface{}, k string) (ws []string, es []error) {
value := v.(string)

if matched := regexp.MustCompile(`^(?:|[\w][\w-/.]{0,398}[\w-])$`).Match([]byte(value)); !matched {
if matched := regexp.MustCompile(`^(?:|[\w.][\w-/.]{0,398}[\w-])$`).Match([]byte(value)); !matched {
es = append(es, fmt.Errorf("%q may only be up to 400 characters in length, not start or end with `/` and only contain valid url characters", k))
}
return ws, es
Expand Down
4 changes: 4 additions & 0 deletions azurerm/helpers/validate/api_management_test.go
Expand Up @@ -126,6 +126,10 @@ func TestAzureRMApiManagementApiPath_validation(t *testing.T) {
Value: "api1/sub",
ErrCount: 0,
},
{
Value: ".well-known",
ErrCount: 0,
},
{
Value: s.Repeat("x", 401),
ErrCount: 1,
Expand Down

0 comments on commit 127eb47

Please sign in to comment.