next-tinacms-s3 22.0.3 → 22.0.4
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.js +5 -4
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_MEDIA_UPLOAD_TYPES } from "tinacms";
|
|
1
|
+
import { DEFAULT_MEDIA_UPLOAD_TYPES, sanitizeFilename } from "tinacms";
|
|
2
2
|
class MediaListError extends Error {
|
|
3
3
|
constructor(config) {
|
|
4
4
|
super(config.message);
|
|
@@ -71,7 +71,8 @@ class S3MediaStore {
|
|
|
71
71
|
if (directory == null ? void 0 : directory.endsWith("/")) {
|
|
72
72
|
directory = directory.substr(0, directory.length - 1);
|
|
73
73
|
}
|
|
74
|
-
const
|
|
74
|
+
const safeName = sanitizeFilename(item.file.name);
|
|
75
|
+
const path = `${directory && directory !== "/" ? `${directory}/${safeName}` : safeName}`;
|
|
75
76
|
const res = await this.fetchWithBasePath(
|
|
76
77
|
`/api/s3/media/upload_url?key=${path}`,
|
|
77
78
|
{
|
|
@@ -108,8 +109,8 @@ class S3MediaStore {
|
|
|
108
109
|
});
|
|
109
110
|
newFiles.push({
|
|
110
111
|
directory: item.directory,
|
|
111
|
-
filename:
|
|
112
|
-
id:
|
|
112
|
+
filename: safeName,
|
|
113
|
+
id: safeName,
|
|
113
114
|
type: "file",
|
|
114
115
|
thumbnails: {
|
|
115
116
|
"75x75": src,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-tinacms-s3",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "22.0.
|
|
4
|
+
"version": "22.0.4",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"files": [
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"react-dom": "^18.3.1",
|
|
29
29
|
"typescript": "^5.7.3",
|
|
30
30
|
"@tinacms/scripts": "1.6.1",
|
|
31
|
-
"tinacms": "3.8.
|
|
31
|
+
"tinacms": "3.8.4"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"tinacms": "3.8.
|
|
34
|
+
"tinacms": "3.8.4"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"registry": "https://registry.npmjs.org"
|