aws-architect 6.6.34 → 6.6.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/BucketManager.js +7 -3
- package/lib/server.js +5 -0
- package/package.json +1 -1
package/lib/BucketManager.js
CHANGED
|
@@ -167,15 +167,19 @@ class BucketManager {
|
|
|
167
167
|
throw { title: 'Failed to validate deployment bucket is available', error, bucket };
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
const
|
|
171
|
-
|
|
170
|
+
const params = { Bucket: bucket, ObjectOwnership: 'BucketOwnerEnforced' };
|
|
171
|
+
if (this.S3Manager.config.region !== 'us-east-1') {
|
|
172
|
+
params.CreateBucketConfiguration = { LocationConstraint: this.S3Manager.config.region };
|
|
173
|
+
}
|
|
174
|
+
await this.S3Manager.createBucket(params).promise();
|
|
172
175
|
await this.S3Manager.putPublicAccessBlock({
|
|
173
176
|
Bucket: bucket, PublicAccessBlockConfiguration: { BlockPublicAcls: true, BlockPublicPolicy: true, IgnorePublicAcls: true, RestrictPublicBuckets: true }
|
|
174
177
|
}).promise();
|
|
175
178
|
}
|
|
176
179
|
}
|
|
177
180
|
|
|
178
|
-
//
|
|
181
|
+
// Ensures a path will be in unix format (that is, forward slash), also on Windows systems.
|
|
182
|
+
// * On windows the nodejs "path" library incorrectly uses backlash (\) even when we aren't writing to the filesystem. So this fixes the paths since we are writing to S3 in this class
|
|
179
183
|
unixify(fullPath) {
|
|
180
184
|
return fullPath.replace(/\\/g, '/');
|
|
181
185
|
}
|
package/lib/server.js
CHANGED
|
@@ -208,6 +208,11 @@ function Server(contentDirectory, lambdaApi, logger) {
|
|
|
208
208
|
this.logger(`StatusCode: ${response.statusCode}`);
|
|
209
209
|
this.logger(`Headers: ${stringify(responseHeaders, null, 2)}`);
|
|
210
210
|
|
|
211
|
+
if (response.isBase64Encoded) {
|
|
212
|
+
this.logger('Body: <Binary>');
|
|
213
|
+
return res.status(response.statusCode).send(Buffer.from(response.body, 'base64'));
|
|
214
|
+
}
|
|
215
|
+
|
|
211
216
|
try {
|
|
212
217
|
response.body = response.body && response.body.replace(/"https?:\/\/(localhost:\d{2,5})\/([^"]*)"/g, '"http://$1/api/$2"');
|
|
213
218
|
let json = JSON.parse(response.body);
|