Repository navigation
Commit 7c4eb71
authored
fix(stepfunctions): regex in DistributedMap label is incorrectly escaping characters (#29765)
Regex is incorrect. Switching to basic regex. Fixing regex to properly escape special characters
### Reason for this change
Regex was incorrectly escaping the `]` character, and as such was falsely returning `true`. It also seemed to be interpreting the `\` characters incorrectly, so I switched to a regex literal in line to fix that.
### Description of changes
Switch from `RegExp` object to inline regex.
Fix regex to correctly escape `]` character.
### Description of how you validated changes
Running in Node CLI, such as:
```node
> /[\s\?\*\<\>\{\}\\[\]\:\;\,\|\^\~\$\#\%\&\`\"]|[\u0000-\u001f]|[\u007f-\u009f]/gi.test(' ')
true
```
Running in Chrome Dev Tools console, such as:
```js
new RegExp("/[\s\?\*\<\>\{\}\\[\]\:\;\,\|\^\~\$\#\%\&\`\"]|[\u0000-\u001f]|[\u007f-\u009f]/gi").test(' ')
false
```
no
### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*1 parent fc890df commit 7c4eb71
2 files changed
Lines changed: 15 additions & 2 deletions
File tree
- packages/aws-cdk-lib/aws-stepfunctions
- lib/states
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
765 | 765 | | |
766 | 766 | | |
767 | 767 | | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
768 | 781 | | |
769 | 782 | | |
770 | 783 | | |
| |||
777 | 790 | | |
778 | 791 | | |
779 | 792 | | |
780 | | - | |
| 793 | + | |
0 commit comments