Commit 67b85f2
authored
fix(s3-deployment):
In cdk-lib aws-s3-deployment, creating a Source.jsonData() will fail if the JSON has any null fields in it due to `escapeTokens` trying to build an object from it, resulting in `TypeError: Cannot convert undefined or null to object`
### Issue # (if applicable)
Closes #36052.
### Reason for this change
Can't create a Source.jsonData() when `null` values are present in the JSON data itself
### Description of changes
Added a null check around `escapeTokens()` to prevent it from trying to process `null` values
### Describe any new or updated permissions being added
N/A
### Description of how you validated changes
Tested by hand via modifying the compiled JS in my project to add the check, and was able to successfully upload a JSON file to S3 with a null value contained inside. Also added coverage via unit tests/integration tests for the PR build to chew through.
### 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*Source.jsonData() fails with null JSON values (#36054)1 parent 56f22aa commit 67b85f2
File tree
11 files changed
+1839
-206
lines changed- packages
- @aws-cdk-testing/framework-integ/test/aws-s3-deployment/test
- integ.bucket-deployment-data.js.snapshot
- asset.8de7dc173740857dd772ca214c7ac8381483f7ee406d94fb9ff9e95ad407d876/my-json
- asset.ca235e6258b11c240506ff06f79037eca461b8d0d9464a947a386d38d8163515.bundle
- aws-cdk-lib/aws-s3-deployment
- lib
- test
11 files changed
+1839
-206
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 50 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 17 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
221 | 224 | | |
222 | 225 | | |
223 | 226 | | |
| |||
230 | 233 | | |
231 | 234 | | |
232 | 235 | | |
233 | | - | |
| 236 | + | |
| 237 | + | |
234 | 238 | | |
235 | 239 | | |
236 | 240 | | |
| |||
334 | 338 | | |
335 | 339 | | |
336 | 340 | | |
| 341 | + | |
337 | 342 | | |
338 | 343 | | |
339 | 344 | | |
| |||
346 | 351 | | |
347 | 352 | | |
348 | 353 | | |
| 354 | + | |
349 | 355 | | |
350 | 356 | | |
351 | 357 | | |
| |||
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
| 83 | + | |
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
| |||
105 | 109 | | |
106 | 110 | | |
107 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
108 | 123 | | |
109 | 124 | | |
110 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
| 283 | + | |
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| |||
0 commit comments