@cedarjs/cli 8.0.0-canary.3402 → 8.0.0-canary.3403

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.
@@ -1,8 +1,8 @@
1
1
  import {
2
+ acceptedContentType,
2
3
  confirmUpload as confirmUploadRecord,
3
4
  createPresignedUpload,
4
5
  getUploadTokenPayload,
5
- isMimeTypeAllowed,
6
6
  issueUploadToken,
7
7
  resolveProfile,
8
8
  resolveTarget,
@@ -71,18 +71,27 @@ export const uploadFile = async ({
71
71
  )
72
72
  }
73
73
 
74
- if (!isMimeTypeAllowed(profile.allowedMimeTypes, input.mimeType)) {
74
+ // Checked by what the bytes are, not the type the client claimed, and
75
+ // stored under the type returned
76
+ const data = Buffer.from(input.data, 'base64')
77
+ const mimeType = acceptedContentType(
78
+ data,
79
+ profile.allowedMimeTypes,
80
+ input.mimeType,
81
+ )
82
+
83
+ if (!mimeType) {
75
84
  throw new UploadError(
76
85
  'MIME_TYPE_NOT_ALLOWED',
77
- `File type '${input.mimeType}' is not allowed for upload profile '${profile.name}'.`,
86
+ `That file is not a type allowed for upload profile '${profile.name}'.`,
78
87
  )
79
88
  }
80
89
 
81
90
  return storeFile(target, {
82
91
  db,
83
92
  filename: input.filename,
84
- mimeType: input.mimeType,
85
- data: Buffer.from(input.data, 'base64'),
93
+ mimeType,
94
+ data,
86
95
  maxSize: profile.maxFileSize,
87
96
  userId: context.currentUser ? String(context.currentUser.id) : undefined,
88
97
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "8.0.0-canary.3402",
3
+ "version": "8.0.0-canary.3403",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,17 +36,17 @@
36
36
  "@babel/preset-typescript": "7.29.7",
37
37
  "@babel/traverse": "7.29.10",
38
38
  "@babel/types": "7.29.8",
39
- "@cedarjs/api-server": "8.0.0-canary.3402",
40
- "@cedarjs/babel-config": "8.0.0-canary.3402",
41
- "@cedarjs/cli-helpers": "8.0.0-canary.3402",
42
- "@cedarjs/internal": "8.0.0-canary.3402",
43
- "@cedarjs/prerender": "8.0.0-canary.3402",
44
- "@cedarjs/project-config": "8.0.0-canary.3402",
45
- "@cedarjs/structure": "8.0.0-canary.3402",
46
- "@cedarjs/telemetry": "8.0.0-canary.3402",
47
- "@cedarjs/utils": "8.0.0-canary.3402",
48
- "@cedarjs/vite": "8.0.0-canary.3402",
49
- "@cedarjs/web-server": "8.0.0-canary.3402",
39
+ "@cedarjs/api-server": "8.0.0-canary.3403",
40
+ "@cedarjs/babel-config": "8.0.0-canary.3403",
41
+ "@cedarjs/cli-helpers": "8.0.0-canary.3403",
42
+ "@cedarjs/internal": "8.0.0-canary.3403",
43
+ "@cedarjs/prerender": "8.0.0-canary.3403",
44
+ "@cedarjs/project-config": "8.0.0-canary.3403",
45
+ "@cedarjs/structure": "8.0.0-canary.3403",
46
+ "@cedarjs/telemetry": "8.0.0-canary.3403",
47
+ "@cedarjs/utils": "8.0.0-canary.3403",
48
+ "@cedarjs/vite": "8.0.0-canary.3403",
49
+ "@cedarjs/web-server": "8.0.0-canary.3403",
50
50
  "@listr2/prompt-adapter-enquirer": "4.3.3",
51
51
  "@opentelemetry/api": "1.9.1",
52
52
  "@opentelemetry/core": "2.12.0",
@@ -94,7 +94,7 @@
94
94
  "yargs": "17.7.3"
95
95
  },
96
96
  "devDependencies": {
97
- "@cedarjs/framework-tools": "8.0.0-canary.3402",
97
+ "@cedarjs/framework-tools": "8.0.0-canary.3403",
98
98
  "@prisma/dmmf": "7.10.0",
99
99
  "@types/archiver": "^7.0.0",
100
100
  "memfs": "4.80.0",