next-tinacms-dos 5.0.0 → 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
|
@@ -72,6 +72,7 @@ var createMediaHandler = (config, options) => {
|
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
74
|
async function uploadMedia(req, res, client, bucket, mediaRoot, cdnUrl) {
|
|
75
|
+
var _a;
|
|
75
76
|
const upload = (0, import_util.promisify)(
|
|
76
77
|
(0, import_multer.default)({
|
|
77
78
|
storage: import_multer.default.diskStorage({
|
|
@@ -90,13 +91,15 @@ async function uploadMedia(req, res, client, bucket, mediaRoot, cdnUrl) {
|
|
|
90
91
|
if (prefix)
|
|
91
92
|
prefix = prefix + "/";
|
|
92
93
|
const filePath = req.file.path;
|
|
94
|
+
const fileType = (_a = req.file) == null ? void 0 : _a.mimetype;
|
|
93
95
|
const blob = import_fs.default.readFileSync(filePath);
|
|
94
96
|
const filename = import_path.default.basename(filePath);
|
|
95
97
|
const params = {
|
|
96
98
|
Bucket: bucket,
|
|
97
99
|
Key: mediaRoot ? import_path.default.join(mediaRoot, prefix + filename) : prefix + filename,
|
|
98
100
|
Body: blob,
|
|
99
|
-
ACL: "public-read"
|
|
101
|
+
ACL: "public-read",
|
|
102
|
+
ContentType: fileType || "application/octet-stream"
|
|
100
103
|
};
|
|
101
104
|
const command = new import_client_s3.PutObjectCommand(params);
|
|
102
105
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-tinacms-dos",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"files": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"tinacms": "2.2.
|
|
21
|
+
"tinacms": "2.2.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/crypto-js": "^3.1.47",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"react": "^18.3.1",
|
|
29
29
|
"react-dom": "^18.3.1",
|
|
30
30
|
"typescript": "4.6.4",
|
|
31
|
-
"@tinacms/scripts": "1.2.
|
|
32
|
-
"tinacms": "2.2.
|
|
31
|
+
"@tinacms/scripts": "1.2.1",
|
|
32
|
+
"tinacms": "2.2.2"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"registry": "https://registry.npmjs.org"
|