Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update path validation for azure_rm_api_management_api #7478

Merged
merged 3 commits into from Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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