next-tinacms-s3 5.0.1 → 5.0.2
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/handlers.js +4 -1
- package/package.json +4 -4
package/dist/handlers.js
CHANGED
|
@@ -74,6 +74,7 @@ var createMediaHandler = (config, options) => {
|
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
76
|
async function uploadMedia(req, res, client, bucket, mediaRoot, cdnUrl) {
|
|
77
|
+
var _a;
|
|
77
78
|
try {
|
|
78
79
|
const upload = (0, import_util.promisify)(
|
|
79
80
|
(0, import_multer.default)({
|
|
@@ -93,13 +94,15 @@ async function uploadMedia(req, res, client, bucket, mediaRoot, cdnUrl) {
|
|
|
93
94
|
if (prefix)
|
|
94
95
|
prefix = prefix + "/";
|
|
95
96
|
const filePath = req.file.path;
|
|
97
|
+
const fileType = (_a = req.file) == null ? void 0 : _a.mimetype;
|
|
96
98
|
const blob = import_fs.default.readFileSync(filePath);
|
|
97
99
|
const filename = import_path.default.basename(filePath);
|
|
98
100
|
const params = {
|
|
99
101
|
Bucket: bucket,
|
|
100
102
|
Key: mediaRoot ? import_path.default.join(mediaRoot, prefix + filename) : prefix + filename,
|
|
101
103
|
Body: blob,
|
|
102
|
-
ACL: "public-read"
|
|
104
|
+
ACL: "public-read",
|
|
105
|
+
ContentType: fileType || "application/octet-stream"
|
|
103
106
|
};
|
|
104
107
|
const command = new import_client_s3.PutObjectCommand(params);
|
|
105
108
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-tinacms-s3",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"files": [
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"react": "^18.3.1",
|
|
27
27
|
"react-dom": "^18.3.1",
|
|
28
28
|
"typescript": "^5.5.4",
|
|
29
|
-
"@tinacms/scripts": "1.2.
|
|
30
|
-
"tinacms": "2.2.
|
|
29
|
+
"@tinacms/scripts": "1.2.1",
|
|
30
|
+
"tinacms": "2.2.2"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"tinacms": "2.2.
|
|
33
|
+
"tinacms": "2.2.2"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"registry": "https://registry.npmjs.org"
|