next-tinacms-s3 22.0.3 → 23.0.0

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.
Files changed (2) hide show
  1. package/dist/index.js +5 -4
  2. 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 path = `${directory && directory !== "/" ? `${directory}/${item.file.name}` : item.file.name}`;
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: item.file.name,
112
- id: item.file.name,
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.3",
4
+ "version": "23.0.0",
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.3"
31
+ "tinacms": "3.9.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "tinacms": "3.8.3"
34
+ "tinacms": "3.9.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "registry": "https://registry.npmjs.org"