@adobe/helix-admin-support 1.3.12 → 1.3.13
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/fetch-s3.js +7 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.3.13](https://github.com/adobe/helix-admin-support/compare/v1.3.12...v1.3.13) (2022-09-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fetch S3 regression ([fa2b571](https://github.com/adobe/helix-admin-support/commit/fa2b5715112314224feb520af16f93a51fc0e4bb))
|
|
7
|
+
|
|
1
8
|
## [1.3.12](https://github.com/adobe/helix-admin-support/compare/v1.3.11...v1.3.12) (2022-09-27)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/fetch-s3.js
CHANGED
|
@@ -62,23 +62,21 @@ export async function fetchS3(context, bucketId, key, head = false) {
|
|
|
62
62
|
const s3 = new S3Client(opts);
|
|
63
63
|
const Command = head ? HeadObjectCommand : GetObjectCommand;
|
|
64
64
|
let res;
|
|
65
|
+
let buffer = '';
|
|
65
66
|
try {
|
|
66
67
|
res = await s3.send(new Command({
|
|
67
68
|
Bucket: bucketId,
|
|
68
69
|
Key: key,
|
|
69
|
-
// todo: add timeout
|
|
70
70
|
}));
|
|
71
|
+
if (!head) {
|
|
72
|
+
buffer = await new Response(res.Body, {}).buffer();
|
|
73
|
+
if (res.ContentEncoding === 'gzip') {
|
|
74
|
+
buffer = await gunzip(buffer);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
71
77
|
} finally {
|
|
72
78
|
s3.destroy();
|
|
73
79
|
}
|
|
74
|
-
|
|
75
|
-
let buffer = '';
|
|
76
|
-
if (!head) {
|
|
77
|
-
buffer = await new Response(res.Body, {}).buffer();
|
|
78
|
-
if (res.ContentEncoding === 'gzip') {
|
|
79
|
-
buffer = await gunzip(buffer);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
80
|
const headers = {};
|
|
83
81
|
if (res.LastModified) {
|
|
84
82
|
headers['last-modified'] = res.LastModified.toUTCString();
|