@ditojs/server 2.88.0 → 2.90.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditojs/server",
3
- "version": "2.88.0",
3
+ "version": "2.90.0",
4
4
  "type": "module",
5
5
  "description": "Dito.js Server – Dito.js is a declarative and modern web framework, based on Objection.js, Koa.js and Vue.js",
6
6
  "repository": "https://github.com/ditojs/dito/tree/main/packages/server",
@@ -25,10 +25,10 @@
25
25
  "node >= 18"
26
26
  ],
27
27
  "dependencies": {
28
- "@ditojs/admin": "^2.87.0",
29
- "@ditojs/build": "^2.87.0",
30
- "@ditojs/router": "^2.87.0",
31
- "@ditojs/utils": "^2.87.0",
28
+ "@ditojs/admin": "^2.90.0",
29
+ "@ditojs/build": "^2.90.0",
30
+ "@ditojs/router": "^2.90.0",
31
+ "@ditojs/utils": "^2.90.0",
32
32
  "@koa/cors": "^5.0.0",
33
33
  "@koa/etag": "^5.0.2",
34
34
  "@koa/multer": "^4.0.0",
@@ -90,5 +90,5 @@
90
90
  "objection": "^3.1.5",
91
91
  "typescript": "^5.9.3"
92
92
  },
93
- "gitHead": "1d413e8528f8a40e3cc7950db62ebeb4d687ce67"
93
+ "gitHead": "4e5489c32920078f98f23460cef00d658216b878"
94
94
  }
@@ -58,8 +58,6 @@ export class AssetFile {
58
58
  }
59
59
 
60
60
  static convert(object, storage) {
61
- // Signature must never be persisted.
62
- delete object.signature
63
61
  Object.setPrototypeOf(object, AssetFile.prototype)
64
62
  setHiddenProperty(object, SYMBOL_STORAGE, storage)
65
63
  }
@@ -83,17 +83,20 @@ export class Storage {
83
83
  }
84
84
 
85
85
  convertAssetFile(file, { trusted = false } = {}) {
86
- if (!trusted) {
87
- if (this.isImportSourceAllowed(file.url)) {
88
- this.signAssetFile(file)
89
- } else if (!this.verifyAssetFile(file)) {
90
- throw new AssetError(
91
- `Invalid asset signature for file '${
92
- file.name ?? file.key
93
- }'`
94
- )
95
- }
86
+ if (
87
+ !trusted &&
88
+ !(file instanceof AssetFile) &&
89
+ !this.isImportSourceAllowed(file.url) &&
90
+ !this.verifyAssetFile(file)
91
+ ) {
92
+ throw new AssetError(
93
+ `Invalid asset signature for file '${
94
+ file.name ?? file.key
95
+ }'`
96
+ )
96
97
  }
98
+ // Remove signature once the data made it to here.
99
+ delete file.signature
97
100
  AssetFile.convert(file, this)
98
101
  }
99
102
 
@@ -1,7 +1,7 @@
1
1
  import path from 'path'
2
2
 
3
3
  export function resolveFileUrl(url) {
4
- return url.startsWith('file://')
4
+ return url?.startsWith('file://')
5
5
  ? `file://${path.resolve(url.slice(7))}`
6
6
  : url
7
7
  }