APIGateway: Allow semicolon in path (#6159)

This commit is contained in:
Bert Blommers 2023-04-01 23:37:57 +01:00 committed by GitHub
parent d343981916
commit 0e58d3996b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -1734,7 +1734,7 @@ class APIGatewayBackend(BaseBackend):
if not path_part:
# We're attempting to create the default resource, which already exists.
return api.default
if not re.match("^\\{?[a-zA-Z0-9._-]+\\+?\\}?$", path_part):
if not re.match("^\\{?[a-zA-Z0-9._\\-\\:]+\\+?\\}?$", path_part):
raise InvalidResourcePathException()
return api.add_child(path=path_part, parent_id=parent_resource_id)

View File

@ -272,7 +272,7 @@ def test_create_resource__validate_name():
]["id"]
invalid_names = ["/users", "users/", "users/{user_id}", "us{er", "us+er"]
valid_names = ["users", "{user_id}", "{proxy+}", "user_09", "good-dog"]
valid_names = ["users", "{user_id}", "{proxy+}", "{pro:xy+}", "us:er_0-9"]
# All invalid names should throw an exception
for name in invalid_names:
with pytest.raises(ClientError) as ex: