next-tinacms-dos 10.0.6 → 10.0.8
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 -6
- package/package.json +4 -4
package/dist/handlers.js
CHANGED
|
@@ -55,7 +55,7 @@ var createMediaHandler = (config, options) => {
|
|
|
55
55
|
mediaRoot = mediaRoot.substr(1);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
let cdnUrl =
|
|
58
|
+
let cdnUrl = options?.cdnUrl || config.config.endpoint.toString().replace(/http(s|):\/\//i, `https://${bucket}.`);
|
|
59
59
|
cdnUrl = cdnUrl + (cdnUrl.endsWith("/") ? "" : "/");
|
|
60
60
|
return async (req, res) => {
|
|
61
61
|
const isAuthorized = await config.authorized(req, res);
|
|
@@ -76,7 +76,6 @@ var createMediaHandler = (config, options) => {
|
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
78
|
async function uploadMedia(req, res, client, bucket, mediaRoot, cdnUrl) {
|
|
79
|
-
var _a;
|
|
80
79
|
const upload = (0, import_util.promisify)(
|
|
81
80
|
(0, import_multer.default)({
|
|
82
81
|
storage: import_multer.default.diskStorage({
|
|
@@ -96,7 +95,7 @@ async function uploadMedia(req, res, client, bucket, mediaRoot, cdnUrl) {
|
|
|
96
95
|
let prefix = directory.replace(/^\//, "").replace(/\/$/, "");
|
|
97
96
|
if (prefix) prefix = prefix + "/";
|
|
98
97
|
const filePath = req.file.path;
|
|
99
|
-
const fileType =
|
|
98
|
+
const fileType = req.file?.mimetype;
|
|
100
99
|
const blob = import_fs.default.readFileSync(filePath);
|
|
101
100
|
const filename = import_path.default.basename(filePath);
|
|
102
101
|
const params = {
|
|
@@ -145,7 +144,6 @@ function stripMediaRoot(mediaRoot, key) {
|
|
|
145
144
|
return keyParts.join("/");
|
|
146
145
|
}
|
|
147
146
|
async function listMedia(req, res, client, bucket, mediaRoot, cdnUrl) {
|
|
148
|
-
var _a;
|
|
149
147
|
try {
|
|
150
148
|
const {
|
|
151
149
|
directory = "",
|
|
@@ -158,12 +156,12 @@ async function listMedia(req, res, client, bucket, mediaRoot, cdnUrl) {
|
|
|
158
156
|
Bucket: bucket,
|
|
159
157
|
Delimiter: "/",
|
|
160
158
|
Prefix: mediaRoot ? import_path.default.join(mediaRoot, prefix) : prefix,
|
|
161
|
-
Marker: offset
|
|
159
|
+
Marker: offset?.toString(),
|
|
162
160
|
MaxKeys: directory && !offset ? +limit + 1 : +limit
|
|
163
161
|
};
|
|
164
162
|
const response = await client.send(new import_client_s3.ListObjectsCommand(params));
|
|
165
163
|
const items = [];
|
|
166
|
-
|
|
164
|
+
response.CommonPrefixes?.forEach(({ Prefix }) => {
|
|
167
165
|
const strippedPrefix = stripMediaRoot(mediaRoot, Prefix);
|
|
168
166
|
if (!strippedPrefix) {
|
|
169
167
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-tinacms-dos",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.8",
|
|
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.7.
|
|
21
|
+
"tinacms": "2.7.8"
|
|
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": "^5.7.3",
|
|
31
|
-
"tinacms": "2.7.
|
|
32
|
-
"@tinacms/scripts": "1.3.
|
|
31
|
+
"tinacms": "2.7.8",
|
|
32
|
+
"@tinacms/scripts": "1.3.5"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"registry": "https://registry.npmjs.org"
|