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

Allow single character strings in azure_rm_api_management_api Path variable validation #26922

Merged
merged 2 commits into from
Aug 16, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,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.][\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
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ func TestAzureRMApiManagementApiPath_validation(t *testing.T) {
Value: "api1:sub",
ErrCount: 0,
},
{
Value: "a",
ErrCount: 0,
},
{
Value: s.Repeat("x", 401),
ErrCount: 1,
Expand Down
Loading