Skip to content
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
}
Expand All @@ -230,7 +233,8 @@
"4ba8cfb53da242e91a423f3333c95db70ac0b5c2481a2d7e5c51142e5738403f.zip",
"4458891c23c9754723db261b607985ee4fce5a087343fca93e9608fb49e083ba.zip",
"c3f91ed893cc759513d80ebd56bcaae5061b08bff3dd8ad10daeb62558bac52e.zip",
"10cb9bf43614add407e699e4af8e1ba4a9789363f48fa816662b15885c354e1a.zip"
"10cb9bf43614add407e699e4af8e1ba4a9789363f48fa816662b15885c354e1a.zip",
"8de7dc173740857dd772ca214c7ac8381483f7ee406d94fb9ff9e95ad407d876.zip"
],
"SourceMarkers": [
{},
Expand Down Expand Up @@ -334,6 +338,7 @@
]
}
},
{},
{}
],
"SourceMarkersConfig": [
Expand All @@ -346,6 +351,7 @@
"jsonEscape": true
},
{},
{},
{}
],
"DestinationBucketName": {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class TestBucketDeploymentData extends Stack {
// Test empty string handling
const file8 = Source.data('file8.txt', '');

// Test null JSON data value
const file9 = Source.jsonData('my-json/config-with-null.json', { hello: 'there', goodbye: null });

const deployment = new BucketDeployment(this, 'DeployWithDataSources', {
destinationBucket: this.bucket,
sources: [file1, file2],
Expand All @@ -77,6 +80,7 @@ class TestBucketDeploymentData extends Stack {
deployment.addSource(file6);
deployment.addSource(file7);
deployment.addSource(file8);
deployment.addSource(file9);

new CfnOutput(this, 'BucketName', { value: this.bucket.bucketName });
}
Expand Down Expand Up @@ -105,6 +109,17 @@ assertionProvider.expect(ExpectedResult.objectLike({
Body: '{"secret_value":"test\\"with\\"quotes"}',
}));

// Assert that JSON data with a null value is represented properly
const jsonNullAssertionProvider = integTest.assertions.awsApiCall('S3', 'getObject', {
Bucket: testCase.bucket.bucketName,
Key: path.join('deploy/here', 'my-json/config-with-null.json'),
});

// Verify the content is valid JSON and both null and non-null fields are present
jsonNullAssertionProvider.expect(ExpectedResult.objectLike({
Body: '{"hello":"there","goodbye":null}',
}));

// Add assertions to verify the YAML file
const yamlAssertionProvider = integTest.assertions.awsApiCall('S3', 'getObject', {
Bucket: testCase.bucket.bucketName,
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-s3-deployment/lib/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export class Source {
return obj.map(v => Source.escapeTokens(scope, v));
}

if (typeof obj === 'object') {
if (obj !== null && typeof obj === 'object') {
Copy link
Member

@Abogical Abogical Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return Object.fromEntries(
Object.entries(obj).map(([key, value]) => {
// As JSON keys are always strings, keys are assumed to be either regular strings or string tokens.
Expand Down
Loading
Loading