@hdriel/aws-utils 1.3.2 → 1.3.3
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/dist/index.cjs +7 -1
- package/dist/index.js +7 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1666,7 +1666,13 @@ var S3Stream = class _S3Stream extends S3File {
|
|
|
1666
1666
|
const fileName = filename || normalizedKey.split("/").pop() || `${Date.now()}.${ext}`;
|
|
1667
1667
|
const inlineTypes = ["text/", "image/", "application/pdf", "video/", "audio/"];
|
|
1668
1668
|
const canDisplayInline = SUPPORTED_IFRAME_EXTENSIONS.includes(ext) || inlineTypes.some((type) => contentType.startsWith(type));
|
|
1669
|
-
|
|
1669
|
+
const shouldIncludeCharSet = contentType.startsWith("text/") || contentType === "application/json" || contentType === "application/xml" || contentType === "application/javascript" || contentType === "application/xhtml+xml";
|
|
1670
|
+
if (shouldIncludeCharSet) {
|
|
1671
|
+
res.setHeader("Content-Type", `${contentType}; charset=utf-8`);
|
|
1672
|
+
stream.setEncoding("utf8");
|
|
1673
|
+
} else {
|
|
1674
|
+
res.setHeader("Content-Type", contentType);
|
|
1675
|
+
}
|
|
1670
1676
|
if (fileInfo.ContentLength) {
|
|
1671
1677
|
res.setHeader("Content-Length", String(fileInfo.ContentLength));
|
|
1672
1678
|
}
|
package/dist/index.js
CHANGED
|
@@ -1654,7 +1654,13 @@ var S3Stream = class _S3Stream extends S3File {
|
|
|
1654
1654
|
const fileName = filename || normalizedKey.split("/").pop() || `${Date.now()}.${ext}`;
|
|
1655
1655
|
const inlineTypes = ["text/", "image/", "application/pdf", "video/", "audio/"];
|
|
1656
1656
|
const canDisplayInline = SUPPORTED_IFRAME_EXTENSIONS.includes(ext) || inlineTypes.some((type) => contentType.startsWith(type));
|
|
1657
|
-
|
|
1657
|
+
const shouldIncludeCharSet = contentType.startsWith("text/") || contentType === "application/json" || contentType === "application/xml" || contentType === "application/javascript" || contentType === "application/xhtml+xml";
|
|
1658
|
+
if (shouldIncludeCharSet) {
|
|
1659
|
+
res.setHeader("Content-Type", `${contentType}; charset=utf-8`);
|
|
1660
|
+
stream.setEncoding("utf8");
|
|
1661
|
+
} else {
|
|
1662
|
+
res.setHeader("Content-Type", contentType);
|
|
1663
|
+
}
|
|
1658
1664
|
if (fileInfo.ContentLength) {
|
|
1659
1665
|
res.setHeader("Content-Length", String(fileInfo.ContentLength));
|
|
1660
1666
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hdriel/aws-utils",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Simplified AWS SDK (v3) utilities for S3 (upload, download, streaming) with TypeScript support",
|
|
5
5
|
"author": "Hadriel Benjo (https://github.com/hdriel)",
|
|
6
6
|
"type": "module",
|