fix(api-gateway): non-greedy route pattern regex#533
Merged
heitorlessa merged 2 commits intoaws-powertools:developfrom Jul 18, 2021
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #533 +/- ##
========================================
Coverage 99.19% 99.19%
========================================
Files 113 113
Lines 4476 4478 +2
Branches 243 243
========================================
+ Hits 4440 4442 +2
Misses 24 24
Partials 12 12
Continue to review full report at Codecov.
|
Contributor
Author
|
Note: one other bug and potential minor issue to address as part of 1.18 release or the next one after that
|
heitorlessa
added a commit
to whardier/aws-lambda-powertools-python
that referenced
this pull request
Jul 19, 2021
…ent-subclass * develop: fix(api-gateway): non-greedy route pattern regex (aws-powertools#533) chore(deps): bump boto3 from 1.18.0 to 1.18.1 (aws-powertools#528) fix(tracer): mypy generic to preserve decorated method signature (aws-powertools#529) fix(parser): Make ApiGateway version, authorizer fields optional (aws-powertools#532) fix(mypy): fixes to resolve no implicit optional errors (aws-powertools#521) chore(deps): bump boto3 from 1.17.110 to 1.18.0 (aws-powertools#527)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: #520
Description of changes:
This fixes a regex bug that used a greedy pattern ending with incorrect path resolution, as any path after a pattern would be included in the argument.
Excerpt:
In this example, say we have a GET request as
/accounts/123and another as/accounts/123/source_networks, we'd have the following effect prior to this fix:r'^/accounts/(?P<account_id>.+)$'123r'^/accounts/(?P<account_id>.+)/source_networks$'123/source_networksWith this fix,
account_idparameter would be 123 in both occasions due to word boundary not being non-greedy. This also allows an arbitrary number of dynamic route paths and static route paths.r'^/accounts/(?P<account_id>\\w+\\b)$'123r'^/accounts/(?P<account_id>\\w+\\b)/source_networks$'123Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.