@nocobase/plugin-file-manager 2.0.60 → 2.0.62
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/client/templates/file.d.ts +1 -1
- package/dist/externalVersion.js +8 -8
- package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
- package/dist/node_modules/@aws-sdk/lib-storage/package.json +1 -1
- package/dist/node_modules/ali-oss/package.json +1 -1
- package/dist/node_modules/cos-nodejs-sdk-v5/package.json +1 -1
- package/dist/node_modules/mime-match/package.json +1 -1
- package/dist/node_modules/mime-types/package.json +1 -1
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/url-join/package.json +1 -1
- package/dist/server/actions/attachments.js +2 -2
- package/dist/server/actions/index.js +8 -1
- package/dist/server/actions/storage-validation.d.ts +10 -0
- package/dist/server/actions/storage-validation.js +73 -0
- package/dist/server/server.d.ts +2 -0
- package/dist/server/server.js +13 -5
- package/dist/server/storages/local.d.ts +4 -0
- package/dist/server/storages/local.js +57 -10
- package/dist/server/utils.d.ts +2 -0
- package/dist/server/utils.js +41 -2
- package/package.json +2 -2
|
@@ -124,10 +124,10 @@ export declare class FileCollectionTemplate extends CollectionTemplate {
|
|
|
124
124
|
initPrimaryKeyFiledInterface(properties: any): void;
|
|
125
125
|
};
|
|
126
126
|
configurableProperties: {
|
|
127
|
+
title: any;
|
|
127
128
|
name: any;
|
|
128
129
|
createdAt: any;
|
|
129
130
|
updatedAt: any;
|
|
130
|
-
title: any;
|
|
131
131
|
description: any;
|
|
132
132
|
updatedBy: any;
|
|
133
133
|
createdBy: any;
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.0.
|
|
11
|
+
"@nocobase/client": "2.0.62",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"antd": "5.24.2",
|
|
14
14
|
"@ant-design/icons": "5.6.1",
|
|
@@ -16,16 +16,16 @@ module.exports = {
|
|
|
16
16
|
"lodash": "4.18.1",
|
|
17
17
|
"react-i18next": "11.18.6",
|
|
18
18
|
"multer": "1.4.5-lts.2",
|
|
19
|
-
"@nocobase/database": "2.0.
|
|
20
|
-
"@nocobase/server": "2.0.
|
|
21
|
-
"@nocobase/utils": "2.0.
|
|
22
|
-
"@nocobase/test": "2.0.
|
|
19
|
+
"@nocobase/database": "2.0.62",
|
|
20
|
+
"@nocobase/server": "2.0.62",
|
|
21
|
+
"@nocobase/utils": "2.0.62",
|
|
22
|
+
"@nocobase/test": "2.0.62",
|
|
23
23
|
"@formily/react": "2.3.7",
|
|
24
|
-
"@nocobase/flow-engine": "2.0.
|
|
24
|
+
"@nocobase/flow-engine": "2.0.62",
|
|
25
25
|
"@emotion/css": "11.13.0",
|
|
26
26
|
"@formily/antd-v5": "1.2.3",
|
|
27
|
-
"@nocobase/actions": "2.0.
|
|
28
|
-
"@nocobase/plugin-data-source-main": "2.0.
|
|
27
|
+
"@nocobase/actions": "2.0.62",
|
|
28
|
+
"@nocobase/plugin-data-source-main": "2.0.62",
|
|
29
29
|
"sequelize": "6.35.2",
|
|
30
30
|
"axios": "1.7.7"
|
|
31
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.750.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3","test":"yarn g:vitest run","test:browser":"node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.ts","test:browser:watch":"node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.ts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts && yarn test:browser","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts","test:watch":"yarn g:vitest watch"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.750.0","@aws-sdk/credential-provider-node":"3.750.0","@aws-sdk/middleware-bucket-endpoint":"3.734.0","@aws-sdk/middleware-expect-continue":"3.734.0","@aws-sdk/middleware-flexible-checksums":"3.750.0","@aws-sdk/middleware-host-header":"3.734.0","@aws-sdk/middleware-location-constraint":"3.734.0","@aws-sdk/middleware-logger":"3.734.0","@aws-sdk/middleware-recursion-detection":"3.734.0","@aws-sdk/middleware-sdk-s3":"3.750.0","@aws-sdk/middleware-ssec":"3.734.0","@aws-sdk/middleware-user-agent":"3.750.0","@aws-sdk/region-config-resolver":"3.734.0","@aws-sdk/signature-v4-multi-region":"3.750.0","@aws-sdk/types":"3.734.0","@aws-sdk/util-endpoints":"3.743.0","@aws-sdk/util-user-agent-browser":"3.734.0","@aws-sdk/util-user-agent-node":"3.750.0","@aws-sdk/xml-builder":"3.734.0","@smithy/config-resolver":"^4.0.1","@smithy/core":"^3.1.4","@smithy/eventstream-serde-browser":"^4.0.1","@smithy/eventstream-serde-config-resolver":"^4.0.1","@smithy/eventstream-serde-node":"^4.0.1","@smithy/fetch-http-handler":"^5.0.1","@smithy/hash-blob-browser":"^4.0.1","@smithy/hash-node":"^4.0.1","@smithy/hash-stream-node":"^4.0.1","@smithy/invalid-dependency":"^4.0.1","@smithy/md5-js":"^4.0.1","@smithy/middleware-content-length":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/middleware-retry":"^4.0.6","@smithy/middleware-serde":"^4.0.2","@smithy/middleware-stack":"^4.0.1","@smithy/node-config-provider":"^4.0.1","@smithy/node-http-handler":"^4.0.2","@smithy/protocol-http":"^5.0.1","@smithy/smithy-client":"^4.1.5","@smithy/types":"^4.1.0","@smithy/url-parser":"^4.0.1","@smithy/util-base64":"^4.0.0","@smithy/util-body-length-browser":"^4.0.0","@smithy/util-body-length-node":"^4.0.0","@smithy/util-defaults-mode-browser":"^4.0.6","@smithy/util-defaults-mode-node":"^4.0.6","@smithy/util-endpoints":"^3.0.1","@smithy/util-middleware":"^4.0.1","@smithy/util-retry":"^4.0.1","@smithy/util-stream":"^4.1.1","@smithy/util-utf8":"^4.0.0","@smithy/util-waiter":"^4.0.2","tslib":"^2.6.2"},"devDependencies":{"@aws-sdk/signature-v4-crt":"3.750.0","@tsconfig/node18":"18.2.4","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2"},"engines":{"node":">=18.0.0"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["dist-*/**"],"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-s3"},"_lastModified":"2026-
|
|
1
|
+
{"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.750.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3","test":"yarn g:vitest run","test:browser":"node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.ts","test:browser:watch":"node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.ts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts && yarn test:browser","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts","test:watch":"yarn g:vitest watch"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.750.0","@aws-sdk/credential-provider-node":"3.750.0","@aws-sdk/middleware-bucket-endpoint":"3.734.0","@aws-sdk/middleware-expect-continue":"3.734.0","@aws-sdk/middleware-flexible-checksums":"3.750.0","@aws-sdk/middleware-host-header":"3.734.0","@aws-sdk/middleware-location-constraint":"3.734.0","@aws-sdk/middleware-logger":"3.734.0","@aws-sdk/middleware-recursion-detection":"3.734.0","@aws-sdk/middleware-sdk-s3":"3.750.0","@aws-sdk/middleware-ssec":"3.734.0","@aws-sdk/middleware-user-agent":"3.750.0","@aws-sdk/region-config-resolver":"3.734.0","@aws-sdk/signature-v4-multi-region":"3.750.0","@aws-sdk/types":"3.734.0","@aws-sdk/util-endpoints":"3.743.0","@aws-sdk/util-user-agent-browser":"3.734.0","@aws-sdk/util-user-agent-node":"3.750.0","@aws-sdk/xml-builder":"3.734.0","@smithy/config-resolver":"^4.0.1","@smithy/core":"^3.1.4","@smithy/eventstream-serde-browser":"^4.0.1","@smithy/eventstream-serde-config-resolver":"^4.0.1","@smithy/eventstream-serde-node":"^4.0.1","@smithy/fetch-http-handler":"^5.0.1","@smithy/hash-blob-browser":"^4.0.1","@smithy/hash-node":"^4.0.1","@smithy/hash-stream-node":"^4.0.1","@smithy/invalid-dependency":"^4.0.1","@smithy/md5-js":"^4.0.1","@smithy/middleware-content-length":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/middleware-retry":"^4.0.6","@smithy/middleware-serde":"^4.0.2","@smithy/middleware-stack":"^4.0.1","@smithy/node-config-provider":"^4.0.1","@smithy/node-http-handler":"^4.0.2","@smithy/protocol-http":"^5.0.1","@smithy/smithy-client":"^4.1.5","@smithy/types":"^4.1.0","@smithy/url-parser":"^4.0.1","@smithy/util-base64":"^4.0.0","@smithy/util-body-length-browser":"^4.0.0","@smithy/util-body-length-node":"^4.0.0","@smithy/util-defaults-mode-browser":"^4.0.6","@smithy/util-defaults-mode-node":"^4.0.6","@smithy/util-endpoints":"^3.0.1","@smithy/util-middleware":"^4.0.1","@smithy/util-retry":"^4.0.1","@smithy/util-stream":"^4.1.1","@smithy/util-utf8":"^4.0.0","@smithy/util-waiter":"^4.0.2","tslib":"^2.6.2"},"devDependencies":{"@aws-sdk/signature-v4-crt":"3.750.0","@tsconfig/node18":"18.2.4","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2"},"engines":{"node":">=18.0.0"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["dist-*/**"],"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-s3"},"_lastModified":"2026-06-10T17:40:44.066Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@aws-sdk/lib-storage","version":"3.750.0","description":"Storage higher order operation","main":"./dist-cjs/index.js","module":"./dist-es/index.js","types":"./dist-types/index.d.ts","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline lib-storage","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","test":"yarn g:vitest run","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts --mode development","test:watch":"yarn g:vitest watch","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts"},"engines":{"node":">=18.0.0"},"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","dependencies":{"@smithy/abort-controller":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/smithy-client":"^4.1.5","buffer":"5.6.0","events":"3.3.0","stream-browserify":"3.0.0","tslib":"^2.6.2"},"peerDependencies":{"@aws-sdk/client-s3":"^3.750.0"},"devDependencies":{"@aws-sdk/client-s3":"3.750.0","@smithy/types":"^4.1.0","@tsconfig/recommended":"1.0.1","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2","web-streams-polyfill":"3.2.1"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser","fs":false,"stream":"stream-browserify"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"files":["dist-*/**"],"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/lib/lib-storage","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"lib/lib-storage"},"_lastModified":"2026-
|
|
1
|
+
{"name":"@aws-sdk/lib-storage","version":"3.750.0","description":"Storage higher order operation","main":"./dist-cjs/index.js","module":"./dist-es/index.js","types":"./dist-types/index.d.ts","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline lib-storage","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","test":"yarn g:vitest run","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts --mode development","test:watch":"yarn g:vitest watch","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts"},"engines":{"node":">=18.0.0"},"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","dependencies":{"@smithy/abort-controller":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/smithy-client":"^4.1.5","buffer":"5.6.0","events":"3.3.0","stream-browserify":"3.0.0","tslib":"^2.6.2"},"peerDependencies":{"@aws-sdk/client-s3":"^3.750.0"},"devDependencies":{"@aws-sdk/client-s3":"3.750.0","@smithy/types":"^4.1.0","@tsconfig/recommended":"1.0.1","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2","web-streams-polyfill":"3.2.1"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser","fs":false,"stream":"stream-browserify"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"files":["dist-*/**"],"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/lib/lib-storage","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"lib/lib-storage"},"_lastModified":"2026-06-10T17:40:45.169Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ali-oss","version":"6.20.0","description":"aliyun oss(object storage service) node client","main":"./lib/client.js","files":["lib","shims","dist"],"browser":{"./lib/client.js":"./dist/aliyun-oss-sdk.js","mime":"mime/lite","urllib":"./shims/xhr.js","utility":"./shims/utility.js","crypto":"./shims/crypto/crypto.js","debug":"./shims/debug","fs":false,"child_process":false,"is-type-of":"./shims/is-type-of.js"},"scripts":{"build-change-log":"standard-version","test":"npm run tsc && mocha -t 120000 -r should -r dotenv/config test/node/*.test.js test/node/**/*.test.js","test-cov":"npm run tsc && nyc --reporter=lcov node_modules/.bin/_mocha -t 120000 -r should test/node/*.test.js test/node/**/*.test.js","jshint":"jshint .","build-test":"MINIFY=1 node browser-build.js > test/browser/build/aliyun-oss-sdk.min.js && node -r dotenv/config task/browser-test-build.js > test/browser/build/tests.js","browser-test":"npm run build-test && karma start","build-dist":"npm run tsc && node browser-build.js > dist/aliyun-oss-sdk.js && MINIFY=1 node browser-build.js > dist/aliyun-oss-sdk.min.js","publish-to-npm":"node publish-npm-check.js && npm publish","publish-to-cdn":"node publish.js","snyk-protect":"snyk-protect","lint-staged":"lint-staged","detect-secrets":"node task/detect-secrets","tsc":"npm run tsc:clean && npm run tsc:build","tsc:build":"tsc -b tsconfig.json tsconfig-cjs.json","tsc:watch":"tsc -b tsconfig.json tsconfig-cjs.json --watch","tsc:clean":"tsc -b tsconfig.json tsconfig-cjs.json --clean ","prepare":"husky install"},"git-pre-hooks":{"pre-release":"npm run build-dist","post-release":["npm run publish-to-npm","npm run publish-to-cdn"]},"homepage":"https://github.com/ali-sdk/ali-oss","bugs":{"url":"https://github.com/ali-sdk/ali-oss/issues"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"repository":{"type":"git","url":"https://github.com/ali-sdk/ali-oss.git"},"keywords":["oss","client","file","aliyun"],"author":"dead_horse","license":"MIT","engines":{"node":">=8"},"devDependencies":{"@babel/core":"^7.11.6","@babel/plugin-transform-regenerator":"^7.10.4","@babel/plugin-transform-runtime":"^7.11.5","@babel/preset-env":"^7.11.5","@babel/runtime":"^7.11.2","@commitlint/cli":"^17.6.7","@commitlint/config-conventional":"^16.2.4","@octokit/core":"^5.0.0","@semantic-release/exec":"^6.0.3","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^10.0.5","@snyk/protect":"^1.1196.0","@types/node":"^14.0.12","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","aliasify":"^2.0.0","axios":"0.27.2","babelify":"^10.0.0","beautify-benchmark":"^0.2.4","benchmark":"^2.1.1","bluebird":"^3.1.5","browserify":"^17.0.0","core-js":"^3.6.5","crypto-js":"^3.1.9-1","dotenv":"^8.2.0","eslint":"^8.44.0","eslint-config-airbnb":"^19.0.4","eslint-config-ali":"^13.0.0","eslint-config-prettier":"^8.8.0","eslint-plugin-import":"^2.21.1","eslint-plugin-jsx-a11y":"^6.0.3","eslint-plugin-prettier":"^4.2.1","filereader":"^0.10.3","form-data":"^4.0.0","git-pre-hooks":"^1.2.0","husky":"^7.0.4","immediate":"^3.3.0","karma":"^6.3.4","karma-browserify":"^8.1.0","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.0.1","karma-ie-launcher":"^1.0.0","karma-mocha":"^2.0.1","karma-safari-launcher":"^1.0.0","lint-staged":"^12.4.1","mm":"^2.0.0","mocha":"^9.1.2","nyc":"^15.1.0","prettier":"^3.0.0","promise-polyfill":"^6.0.2","puppeteer":"19.0.0","semantic-release":"^21.1.1","should":"^11.0.0","sinon":"^15.2.0","standard-version":"^9.3.1","stream-equal":"^1.1.0","timemachine":"^0.3.0","typescript":"^3.9.5","uglify-js":"^3.14.2","watchify":"^4.0.0"},"dependencies":{"address":"^1.2.2","agentkeepalive":"^3.4.1","bowser":"^1.6.0","copy-to":"^2.0.1","dateformat":"^2.0.0","debug":"^4.3.4","destroy":"^1.0.4","end-or-error":"^1.0.1","get-ready":"^1.0.0","humanize-ms":"^1.2.0","is-type-of":"^1.4.0","js-base64":"^2.5.2","jstoxml":"^2.0.0","lodash":"^4.17.21","merge-descriptors":"^1.0.1","mime":"^2.4.5","platform":"^1.3.1","pump":"^3.0.0","qs":"^6.4.0","sdk-base":"^2.0.1","stream-http":"2.8.2","stream-wormhole":"^1.0.4","urllib":"2.41.0","utility":"^1.18.0","xml2js":"^0.6.2"},"snyk":true,"lint-staged":{"**/!(dist)/*":["npm run detect-secrets --"],"**/*.{js,ts}":["eslint --cache --fix --ext .js,.ts","prettier --write","git add"]},"_lastModified":"2026-
|
|
1
|
+
{"name":"ali-oss","version":"6.20.0","description":"aliyun oss(object storage service) node client","main":"./lib/client.js","files":["lib","shims","dist"],"browser":{"./lib/client.js":"./dist/aliyun-oss-sdk.js","mime":"mime/lite","urllib":"./shims/xhr.js","utility":"./shims/utility.js","crypto":"./shims/crypto/crypto.js","debug":"./shims/debug","fs":false,"child_process":false,"is-type-of":"./shims/is-type-of.js"},"scripts":{"build-change-log":"standard-version","test":"npm run tsc && mocha -t 120000 -r should -r dotenv/config test/node/*.test.js test/node/**/*.test.js","test-cov":"npm run tsc && nyc --reporter=lcov node_modules/.bin/_mocha -t 120000 -r should test/node/*.test.js test/node/**/*.test.js","jshint":"jshint .","build-test":"MINIFY=1 node browser-build.js > test/browser/build/aliyun-oss-sdk.min.js && node -r dotenv/config task/browser-test-build.js > test/browser/build/tests.js","browser-test":"npm run build-test && karma start","build-dist":"npm run tsc && node browser-build.js > dist/aliyun-oss-sdk.js && MINIFY=1 node browser-build.js > dist/aliyun-oss-sdk.min.js","publish-to-npm":"node publish-npm-check.js && npm publish","publish-to-cdn":"node publish.js","snyk-protect":"snyk-protect","lint-staged":"lint-staged","detect-secrets":"node task/detect-secrets","tsc":"npm run tsc:clean && npm run tsc:build","tsc:build":"tsc -b tsconfig.json tsconfig-cjs.json","tsc:watch":"tsc -b tsconfig.json tsconfig-cjs.json --watch","tsc:clean":"tsc -b tsconfig.json tsconfig-cjs.json --clean ","prepare":"husky install"},"git-pre-hooks":{"pre-release":"npm run build-dist","post-release":["npm run publish-to-npm","npm run publish-to-cdn"]},"homepage":"https://github.com/ali-sdk/ali-oss","bugs":{"url":"https://github.com/ali-sdk/ali-oss/issues"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"repository":{"type":"git","url":"https://github.com/ali-sdk/ali-oss.git"},"keywords":["oss","client","file","aliyun"],"author":"dead_horse","license":"MIT","engines":{"node":">=8"},"devDependencies":{"@babel/core":"^7.11.6","@babel/plugin-transform-regenerator":"^7.10.4","@babel/plugin-transform-runtime":"^7.11.5","@babel/preset-env":"^7.11.5","@babel/runtime":"^7.11.2","@commitlint/cli":"^17.6.7","@commitlint/config-conventional":"^16.2.4","@octokit/core":"^5.0.0","@semantic-release/exec":"^6.0.3","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^10.0.5","@snyk/protect":"^1.1196.0","@types/node":"^14.0.12","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","aliasify":"^2.0.0","axios":"0.27.2","babelify":"^10.0.0","beautify-benchmark":"^0.2.4","benchmark":"^2.1.1","bluebird":"^3.1.5","browserify":"^17.0.0","core-js":"^3.6.5","crypto-js":"^3.1.9-1","dotenv":"^8.2.0","eslint":"^8.44.0","eslint-config-airbnb":"^19.0.4","eslint-config-ali":"^13.0.0","eslint-config-prettier":"^8.8.0","eslint-plugin-import":"^2.21.1","eslint-plugin-jsx-a11y":"^6.0.3","eslint-plugin-prettier":"^4.2.1","filereader":"^0.10.3","form-data":"^4.0.0","git-pre-hooks":"^1.2.0","husky":"^7.0.4","immediate":"^3.3.0","karma":"^6.3.4","karma-browserify":"^8.1.0","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.0.1","karma-ie-launcher":"^1.0.0","karma-mocha":"^2.0.1","karma-safari-launcher":"^1.0.0","lint-staged":"^12.4.1","mm":"^2.0.0","mocha":"^9.1.2","nyc":"^15.1.0","prettier":"^3.0.0","promise-polyfill":"^6.0.2","puppeteer":"19.0.0","semantic-release":"^21.1.1","should":"^11.0.0","sinon":"^15.2.0","standard-version":"^9.3.1","stream-equal":"^1.1.0","timemachine":"^0.3.0","typescript":"^3.9.5","uglify-js":"^3.14.2","watchify":"^4.0.0"},"dependencies":{"address":"^1.2.2","agentkeepalive":"^3.4.1","bowser":"^1.6.0","copy-to":"^2.0.1","dateformat":"^2.0.0","debug":"^4.3.4","destroy":"^1.0.4","end-or-error":"^1.0.1","get-ready":"^1.0.0","humanize-ms":"^1.2.0","is-type-of":"^1.4.0","js-base64":"^2.5.2","jstoxml":"^2.0.0","lodash":"^4.17.21","merge-descriptors":"^1.0.1","mime":"^2.4.5","platform":"^1.3.1","pump":"^3.0.0","qs":"^6.4.0","sdk-base":"^2.0.1","stream-http":"2.8.2","stream-wormhole":"^1.0.4","urllib":"2.41.0","utility":"^1.18.0","xml2js":"^0.6.2"},"snyk":true,"lint-staged":{"**/!(dist)/*":["npm run detect-secrets --"],"**/*.{js,ts}":["eslint --cache --fix --ext .js,.ts","prettier --write","git add"]},"_lastModified":"2026-06-10T17:40:42.586Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cos-nodejs-sdk-v5","version":"2.12.6","description":"cos nodejs sdk v5","main":"index.js","types":"index.d.ts","scripts":{"prettier":"prettier --write sdk demo/demo.js test/test.js index.d.ts","demo":"node demo/demo.js","demo-sts":"node demo/demo-sts.js","demo-sts-scope":"node demo/demo-sts-scope.js","test":"mocha test/test.js","cov":"istanbul cover _mocha -- -u exports 'test/test.js'","nyc":"nyc --reporter=clover --reporter=cobertura mocha --reporter xunit --reporter-options output=mocha.xml test/test.js","csp":"mocha test/csp.js"},"repository":{"type":"git","url":"git+https://github.com/tencentyun/cos-nodejs-sdk-v5.git"},"keywords":["tencent","tencent cloud","qcloud","cos","cos-sdk"],"author":"carsonxu","license":"ISC","bugs":{"url":"https://github.com/tencentyun/cos-nodejs-sdk-v5/issues"},"homepage":"https://github.com/tencentyun/cos-nodejs-sdk-v5#readme","dependencies":{"conf":"^9.0.0","fast-xml-parser":"4.2.5","mime-types":"^2.1.24","request":"^2.88.2"},"devDependencies":{"@types/node":"^14.14.20","batch":"^0.6.1","crc64-ecma182.js":"^1.0.0","mocha":"^4.0.1","nyc":"^15.1.0","prettier":"^3.0.1","qcloud-cos-sts":"^3.0.0"},"engines":{"node":">= 6"},"_lastModified":"2026-
|
|
1
|
+
{"name":"cos-nodejs-sdk-v5","version":"2.12.6","description":"cos nodejs sdk v5","main":"index.js","types":"index.d.ts","scripts":{"prettier":"prettier --write sdk demo/demo.js test/test.js index.d.ts","demo":"node demo/demo.js","demo-sts":"node demo/demo-sts.js","demo-sts-scope":"node demo/demo-sts-scope.js","test":"mocha test/test.js","cov":"istanbul cover _mocha -- -u exports 'test/test.js'","nyc":"nyc --reporter=clover --reporter=cobertura mocha --reporter xunit --reporter-options output=mocha.xml test/test.js","csp":"mocha test/csp.js"},"repository":{"type":"git","url":"git+https://github.com/tencentyun/cos-nodejs-sdk-v5.git"},"keywords":["tencent","tencent cloud","qcloud","cos","cos-sdk"],"author":"carsonxu","license":"ISC","bugs":{"url":"https://github.com/tencentyun/cos-nodejs-sdk-v5/issues"},"homepage":"https://github.com/tencentyun/cos-nodejs-sdk-v5#readme","dependencies":{"conf":"^9.0.0","fast-xml-parser":"4.2.5","mime-types":"^2.1.24","request":"^2.88.2"},"devDependencies":{"@types/node":"^14.14.20","batch":"^0.6.1","crc64-ecma182.js":"^1.0.0","mocha":"^4.0.1","nyc":"^15.1.0","prettier":"^3.0.1","qcloud-cos-sts":"^3.0.0"},"engines":{"node":">= 6"},"_lastModified":"2026-06-10T17:40:48.698Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mime-match","version":"1.0.2","description":"A simple function to check whether a mimetype matches the specified mimetype (with wildcard support)","main":"index.js","scripts":{"test":"node test.js","gendocs":"gendocs > README.md"},"repository":{"type":"git","url":"https://github.com/DamonOehlman/mime-match.git"},"keywords":["mime","wildcard"],"author":"Damon Oehlman <damon.oehlman@gmail.com>","license":"ISC","bugs":{"url":"https://github.com/DamonOehlman/mime-match/issues"},"homepage":"https://github.com/DamonOehlman/mime-match","dependencies":{"wildcard":"^1.1.0"},"devDependencies":{"tape":"^4.5.1"},"_lastModified":"2026-
|
|
1
|
+
{"name":"mime-match","version":"1.0.2","description":"A simple function to check whether a mimetype matches the specified mimetype (with wildcard support)","main":"index.js","scripts":{"test":"node test.js","gendocs":"gendocs > README.md"},"repository":{"type":"git","url":"https://github.com/DamonOehlman/mime-match.git"},"keywords":["mime","wildcard"],"author":"Damon Oehlman <damon.oehlman@gmail.com>","license":"ISC","bugs":{"url":"https://github.com/DamonOehlman/mime-match/issues"},"homepage":"https://github.com/DamonOehlman/mime-match","dependencies":{"wildcard":"^1.1.0"},"devDependencies":{"tape":"^4.5.1"},"_lastModified":"2026-06-10T17:40:37.430Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mime-types","description":"The ultimate javascript content-type utility.","version":"3.0.1","contributors":["Douglas Christopher Wilson <doug@somethingdoug.com>","Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)","Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"],"license":"MIT","keywords":["mime","types"],"repository":"jshttp/mime-types","dependencies":{"mime-db":"^1.54.0"},"devDependencies":{"eslint":"8.33.0","eslint-config-standard":"14.1.1","eslint-plugin-import":"2.27.5","eslint-plugin-markdown":"3.0.0","eslint-plugin-node":"11.1.0","eslint-plugin-promise":"6.1.1","eslint-plugin-standard":"4.1.0","mocha":"10.2.0","nyc":"15.1.0"},"files":["HISTORY.md","LICENSE","index.js","mimeScore.js"],"engines":{"node":">= 0.6"},"scripts":{"lint":"eslint .","test":"mocha --reporter spec test/test.js","test-ci":"nyc --reporter=lcov --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"_lastModified":"2026-
|
|
1
|
+
{"name":"mime-types","description":"The ultimate javascript content-type utility.","version":"3.0.1","contributors":["Douglas Christopher Wilson <doug@somethingdoug.com>","Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)","Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"],"license":"MIT","keywords":["mime","types"],"repository":"jshttp/mime-types","dependencies":{"mime-db":"^1.54.0"},"devDependencies":{"eslint":"8.33.0","eslint-config-standard":"14.1.1","eslint-plugin-import":"2.27.5","eslint-plugin-markdown":"3.0.0","eslint-plugin-node":"11.1.0","eslint-plugin-promise":"6.1.1","eslint-plugin-standard":"4.1.0","mocha":"10.2.0","nyc":"15.1.0"},"files":["HISTORY.md","LICENSE","index.js","mimeScore.js"],"engines":{"node":">= 0.6"},"scripts":{"lint":"eslint .","test":"mocha --reporter spec test/test.js","test-ci":"nyc --reporter=lcov --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"_lastModified":"2026-06-10T17:40:37.748Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"0.5.6","publishConfig":{"tag":"legacy"},"author":"James Halliday <mail@substack.net> (http://substack.net)","main":"index.js","keywords":["mkdir","directory"],"repository":{"type":"git","url":"https://github.com/substack/node-mkdirp.git"},"scripts":{"test":"tap test/*.js"},"dependencies":{"minimist":"^1.2.6"},"devDependencies":{"tap":"^16.0.1"},"bin":"bin/cmd.js","license":"MIT","files":["bin","index.js"],"_lastModified":"2026-
|
|
1
|
+
{"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"0.5.6","publishConfig":{"tag":"legacy"},"author":"James Halliday <mail@substack.net> (http://substack.net)","main":"index.js","keywords":["mkdir","directory"],"repository":{"type":"git","url":"https://github.com/substack/node-mkdirp.git"},"scripts":{"test":"tap test/*.js"},"dependencies":{"minimist":"^1.2.6"},"devDependencies":{"tap":"^16.0.1"},"bin":"bin/cmd.js","license":"MIT","files":["bin","index.js"],"_lastModified":"2026-06-10T17:40:42.687Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"url-join","version":"4.0.1","description":"Join urls and normalize as in path.join.","main":"lib/url-join.js","scripts":{"test":"mocha --require should"},"repository":{"type":"git","url":"git://github.com/jfromaniello/url-join.git"},"keywords":["url","join"],"author":"José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)","license":"MIT","devDependencies":{"conventional-changelog":"^1.1.10","mocha":"^3.2.0","should":"~1.2.1"},"_lastModified":"2026-
|
|
1
|
+
{"name":"url-join","version":"4.0.1","description":"Join urls and normalize as in path.join.","main":"lib/url-join.js","scripts":{"test":"mocha --require should"},"repository":{"type":"git","url":"git://github.com/jfromaniello/url-join.git"},"keywords":["url","join"],"author":"José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)","license":"MIT","devDependencies":{"conventional-changelog":"^1.1.10","mocha":"^3.2.0","should":"~1.2.1"},"_lastModified":"2026-06-10T17:40:37.526Z"}
|
|
@@ -221,10 +221,10 @@ async function createMiddleware(ctx, next) {
|
|
|
221
221
|
const filePath = (values == null ? void 0 : values.path) ?? "";
|
|
222
222
|
const filename = (values == null ? void 0 : values.filename) ?? "";
|
|
223
223
|
try {
|
|
224
|
-
(0, import_local.resolveSafePath)((0, import_local.getDocumentRoot)(storage), filePath, filename);
|
|
224
|
+
(0, import_local.resolveSafePath)((0, import_local.getDocumentRoot)(storage), (0, import_local.normalizeLocalStoragePath)(filePath), filename);
|
|
225
225
|
} catch (error) {
|
|
226
226
|
if (error.code === "PATH_TRAVERSAL") {
|
|
227
|
-
return ctx.throw(400, error);
|
|
227
|
+
return ctx.throw(400, error.message);
|
|
228
228
|
}
|
|
229
229
|
throw error;
|
|
230
230
|
}
|
|
@@ -41,11 +41,18 @@ __export(actions_exports, {
|
|
|
41
41
|
module.exports = __toCommonJS(actions_exports);
|
|
42
42
|
var import_actions = __toESM(require("@nocobase/actions"));
|
|
43
43
|
var import_attachments = require("./attachments");
|
|
44
|
+
var import_storage_validation = require("./storage-validation");
|
|
44
45
|
var storageActions = __toESM(require("./storages"));
|
|
45
46
|
function actions_default({ app }) {
|
|
46
47
|
app.resourcer.define({
|
|
47
48
|
name: "storages",
|
|
48
|
-
actions: storageActions
|
|
49
|
+
actions: storageActions,
|
|
50
|
+
middlewares: [
|
|
51
|
+
{
|
|
52
|
+
only: ["create", "update"],
|
|
53
|
+
handler: import_storage_validation.validateStorageMiddleware
|
|
54
|
+
}
|
|
55
|
+
]
|
|
49
56
|
});
|
|
50
57
|
app.resourcer.use(import_attachments.createMiddleware, { tag: "createMiddleware", after: "auth" });
|
|
51
58
|
app.resourcer.registerActionHandler("upload", import_actions.default.create);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Context, Next } from '@nocobase/actions';
|
|
10
|
+
export declare function validateStorageMiddleware(ctx: Context, next: Next): Promise<never>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var storage_validation_exports = {};
|
|
28
|
+
__export(storage_validation_exports, {
|
|
29
|
+
validateStorageMiddleware: () => validateStorageMiddleware
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(storage_validation_exports);
|
|
32
|
+
var import_local = require("../storages/local");
|
|
33
|
+
async function validateStorageMiddleware(ctx, next) {
|
|
34
|
+
const { actionName, params } = ctx.action;
|
|
35
|
+
const values = params.values || {};
|
|
36
|
+
let storage = values;
|
|
37
|
+
const hasSubmittedDocumentRoot = Object.prototype.hasOwnProperty.call(values.options || {}, "documentRoot");
|
|
38
|
+
if (actionName === "update" && params.filterByTk) {
|
|
39
|
+
const repository = ctx.db.getRepository("storages");
|
|
40
|
+
let existing = await repository.findById(params.filterByTk);
|
|
41
|
+
if (!existing) {
|
|
42
|
+
existing = await repository.findOne({
|
|
43
|
+
filter: {
|
|
44
|
+
name: params.filterByTk
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (existing) {
|
|
49
|
+
const existingValues = existing.toJSON();
|
|
50
|
+
storage = {
|
|
51
|
+
...existingValues,
|
|
52
|
+
...values,
|
|
53
|
+
options: {
|
|
54
|
+
...existingValues.options || {},
|
|
55
|
+
...values.options || {}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
(0, import_local.validateLocalStorageConfig)(storage, { validateDocumentRoot: hasSubmittedDocumentRoot });
|
|
62
|
+
} catch (error) {
|
|
63
|
+
if (error.code === "PATH_TRAVERSAL") {
|
|
64
|
+
return ctx.throw(400, error.message);
|
|
65
|
+
}
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
await next();
|
|
69
|
+
}
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
validateStorageMiddleware
|
|
73
|
+
});
|
package/dist/server/server.d.ts
CHANGED
|
@@ -17,11 +17,13 @@ export type FileRecordOptions = {
|
|
|
17
17
|
collectionName: string;
|
|
18
18
|
filePath: string;
|
|
19
19
|
storageName?: string;
|
|
20
|
+
subPath?: string;
|
|
20
21
|
values?: any;
|
|
21
22
|
} & Transactionable;
|
|
22
23
|
export type UploadFileOptions = {
|
|
23
24
|
filePath: string;
|
|
24
25
|
storageName?: string;
|
|
26
|
+
subPath?: string;
|
|
25
27
|
documentRoot?: string;
|
|
26
28
|
};
|
|
27
29
|
export declare class PluginFileManagerServer extends Plugin {
|
package/dist/server/server.js
CHANGED
|
@@ -100,29 +100,34 @@ class PluginFileManagerServer extends import_server.Plugin {
|
|
|
100
100
|
this.storageTypes.register(type, Type);
|
|
101
101
|
}
|
|
102
102
|
async createFileRecord(options) {
|
|
103
|
-
const { values, storageName, collectionName, filePath, transaction } = options;
|
|
103
|
+
const { values, storageName, subPath, collectionName, filePath, transaction } = options;
|
|
104
104
|
const collection = this.db.getCollection(collectionName);
|
|
105
105
|
if (!collection) {
|
|
106
106
|
throw new Error(`collection does not exist`);
|
|
107
107
|
}
|
|
108
108
|
const collectionRepository = this.db.getRepository(collectionName);
|
|
109
109
|
const name = storageName || collection.options.storage;
|
|
110
|
-
const data = await this.uploadFile({ storageName: name, filePath });
|
|
110
|
+
const data = await this.uploadFile({ storageName: name, subPath, filePath });
|
|
111
111
|
return await collectionRepository.create({ values: { ...data, ...values }, transaction });
|
|
112
112
|
}
|
|
113
113
|
parseStorage(instance) {
|
|
114
114
|
return this.app.environment.renderJsonTemplate(instance.toJSON());
|
|
115
115
|
}
|
|
116
116
|
async uploadFile(options) {
|
|
117
|
-
const { storageName, filePath, documentRoot } = options;
|
|
117
|
+
const { storageName, subPath, filePath, documentRoot } = options;
|
|
118
118
|
if (!this.storagesCache.size) {
|
|
119
119
|
await this.loadStorages();
|
|
120
120
|
}
|
|
121
121
|
const storages = Array.from(this.storagesCache.values());
|
|
122
|
-
const
|
|
123
|
-
if (!
|
|
122
|
+
const cachedStorage = storages.find((item) => item.name === storageName) || storages.find((item) => item.default);
|
|
123
|
+
if (!cachedStorage) {
|
|
124
124
|
throw new Error("[file-manager] no linked or default storage provided");
|
|
125
125
|
}
|
|
126
|
+
const storage = {
|
|
127
|
+
...cachedStorage,
|
|
128
|
+
options: { ...cachedStorage.options || {} },
|
|
129
|
+
path: (0, import_utils2.resolveStoragePath)(cachedStorage.path, subPath)
|
|
130
|
+
};
|
|
126
131
|
const fileStream = import_fs.default.createReadStream(filePath);
|
|
127
132
|
if (documentRoot) {
|
|
128
133
|
storage.options["documentRoot"] = documentRoot;
|
|
@@ -216,6 +221,9 @@ class PluginFileManagerServer extends import_server.Plugin {
|
|
|
216
221
|
this.storageTypes.register(import_constants.STORAGE_TYPE_S3, import_s3.default);
|
|
217
222
|
this.storageTypes.register(import_constants.STORAGE_TYPE_TX_COS, import_tx_cos.default);
|
|
218
223
|
const Storage = this.db.getModel("storages");
|
|
224
|
+
Storage.beforeSave((m) => {
|
|
225
|
+
(0, import_local.validateLocalStorageConfig)(m.toJSON());
|
|
226
|
+
});
|
|
219
227
|
Storage.afterSave(async (m, { transaction }) => {
|
|
220
228
|
await this.loadStorages({ transaction });
|
|
221
229
|
this.sendSyncMessage({ type: "reloadStorages" }, { transaction });
|
|
@@ -10,8 +10,12 @@
|
|
|
10
10
|
import multer from 'multer';
|
|
11
11
|
import type { Readable } from 'stream';
|
|
12
12
|
import { AttachmentModel, StorageType } from '.';
|
|
13
|
+
export declare function normalizeLocalStoragePath(storagePath?: unknown): string;
|
|
13
14
|
export declare function getDocumentRoot(storage: any): string;
|
|
14
15
|
export declare function resolveSafePath(documentRoot: string, filePath?: string, filename?: string): string;
|
|
16
|
+
export declare function validateLocalStorageConfig(storage: Pick<StorageType['storage'], 'type' | 'options' | 'path'>, { validateDocumentRoot }?: {
|
|
17
|
+
validateDocumentRoot?: boolean;
|
|
18
|
+
}): void;
|
|
15
19
|
export default class extends StorageType {
|
|
16
20
|
static defaults(): {
|
|
17
21
|
title: string;
|
|
@@ -38,7 +38,9 @@ var local_exports = {};
|
|
|
38
38
|
__export(local_exports, {
|
|
39
39
|
default: () => local_default,
|
|
40
40
|
getDocumentRoot: () => getDocumentRoot,
|
|
41
|
-
|
|
41
|
+
normalizeLocalStoragePath: () => normalizeLocalStoragePath,
|
|
42
|
+
resolveSafePath: () => resolveSafePath,
|
|
43
|
+
validateLocalStorageConfig: () => validateLocalStorageConfig
|
|
42
44
|
});
|
|
43
45
|
module.exports = __toCommonJS(local_exports);
|
|
44
46
|
var import_utils = require("@nocobase/utils");
|
|
@@ -51,21 +53,64 @@ var import__ = require(".");
|
|
|
51
53
|
var import_constants = require("../../constants");
|
|
52
54
|
var import_utils2 = require("../utils");
|
|
53
55
|
const DEFAULT_BASE_URL = "/storage/uploads";
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
const DEFAULT_DOCUMENT_ROOT = process.env.LOCAL_STORAGE_DEST || import_path.default.join(process.cwd(), "storage", "uploads");
|
|
57
|
+
function pathError(message) {
|
|
58
|
+
const error = new Error(message);
|
|
59
|
+
error.code = "PATH_TRAVERSAL";
|
|
60
|
+
return error;
|
|
61
|
+
}
|
|
62
|
+
function isInside(base, target) {
|
|
63
|
+
const relative = import_path.default.relative(base, target);
|
|
64
|
+
return !relative.startsWith("..") && !import_path.default.isAbsolute(relative);
|
|
65
|
+
}
|
|
66
|
+
function resolveDocumentRoot(documentRoot) {
|
|
67
|
+
if (typeof documentRoot !== "string" || !documentRoot || documentRoot.includes("\0")) {
|
|
68
|
+
throw pathError("Invalid local storage document root");
|
|
69
|
+
}
|
|
56
70
|
return import_path.default.resolve(import_path.default.isAbsolute(documentRoot) ? documentRoot : import_path.default.join(process.cwd(), documentRoot));
|
|
57
71
|
}
|
|
72
|
+
function allowedRoots() {
|
|
73
|
+
var _a;
|
|
74
|
+
const roots = [import_path.default.resolve(process.cwd(), "storage")];
|
|
75
|
+
const extra = [process.env.LOCAL_STORAGE_DEST, ...((_a = process.env.LOCAL_STORAGE_ALLOWED_ROOTS) == null ? void 0 : _a.split(",")) ?? []];
|
|
76
|
+
for (const item of extra) {
|
|
77
|
+
if (item == null ? void 0 : item.trim()) {
|
|
78
|
+
roots.push(resolveDocumentRoot(item.trim()));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return roots;
|
|
82
|
+
}
|
|
83
|
+
function normalizeLocalStoragePath(storagePath) {
|
|
84
|
+
if (storagePath == null || storagePath === "") {
|
|
85
|
+
return "";
|
|
86
|
+
}
|
|
87
|
+
if (typeof storagePath !== "string" || storagePath.includes("\0")) {
|
|
88
|
+
throw pathError("Invalid local storage path");
|
|
89
|
+
}
|
|
90
|
+
return storagePath.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
91
|
+
}
|
|
92
|
+
function getDocumentRoot(storage) {
|
|
93
|
+
const { documentRoot = DEFAULT_DOCUMENT_ROOT } = storage.options || {};
|
|
94
|
+
return resolveDocumentRoot(documentRoot);
|
|
95
|
+
}
|
|
58
96
|
function resolveSafePath(documentRoot, filePath, filename) {
|
|
59
97
|
const root = import_path.default.resolve(documentRoot);
|
|
60
98
|
const target = import_path.default.resolve(root, filePath || "", filename || "");
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const error = new Error("Access denied");
|
|
64
|
-
error.code = "PATH_TRAVERSAL";
|
|
65
|
-
throw error;
|
|
99
|
+
if (!isInside(root, target)) {
|
|
100
|
+
throw pathError("Access denied");
|
|
66
101
|
}
|
|
67
102
|
return target;
|
|
68
103
|
}
|
|
104
|
+
function validateLocalStorageConfig(storage, { validateDocumentRoot = false } = {}) {
|
|
105
|
+
if (storage.type !== import_constants.STORAGE_TYPE_LOCAL) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const root = getDocumentRoot(storage);
|
|
109
|
+
if (validateDocumentRoot && !allowedRoots().some((allowed) => isInside(allowed, root))) {
|
|
110
|
+
throw pathError("Invalid local storage document root");
|
|
111
|
+
}
|
|
112
|
+
resolveSafePath(root, normalizeLocalStoragePath(storage.path));
|
|
113
|
+
}
|
|
69
114
|
class local_default extends import__.StorageType {
|
|
70
115
|
static defaults() {
|
|
71
116
|
return {
|
|
@@ -85,7 +130,7 @@ class local_default extends import__.StorageType {
|
|
|
85
130
|
make() {
|
|
86
131
|
return import_multer.default.diskStorage({
|
|
87
132
|
destination: (req, file, cb) => {
|
|
88
|
-
const destPath =
|
|
133
|
+
const destPath = resolveSafePath(getDocumentRoot(this.storage), normalizeLocalStoragePath(this.storage.path));
|
|
89
134
|
const mkdirp = require("mkdirp");
|
|
90
135
|
mkdirp(destPath, (err) => cb(err, destPath));
|
|
91
136
|
},
|
|
@@ -158,5 +203,7 @@ class local_default extends import__.StorageType {
|
|
|
158
203
|
// Annotate the CommonJS export names for ESM import in node:
|
|
159
204
|
0 && (module.exports = {
|
|
160
205
|
getDocumentRoot,
|
|
161
|
-
|
|
206
|
+
normalizeLocalStoragePath,
|
|
207
|
+
resolveSafePath,
|
|
208
|
+
validateLocalStorageConfig
|
|
162
209
|
});
|
package/dist/server/utils.d.ts
CHANGED
|
@@ -10,5 +10,7 @@ export declare function getFilename(req: any, file: any, cb: any): void;
|
|
|
10
10
|
export declare const cloudFilenameGetter: (storage: any) => (req: any, file: any, cb: any) => void;
|
|
11
11
|
export declare const diskFilenameGetter: (storage: any) => (req: any, file: any, cb: any) => void;
|
|
12
12
|
export declare function getFileKey(record: any): any;
|
|
13
|
+
export declare function normalizeStorageSubPath(subPath?: unknown): string;
|
|
14
|
+
export declare function resolveStoragePath(storagePath?: unknown, subPath?: unknown): string;
|
|
13
15
|
export declare function ensureUrlEncoded(value: any): any;
|
|
14
16
|
export declare function encodeURL(url: any): any;
|
package/dist/server/utils.js
CHANGED
|
@@ -41,7 +41,9 @@ __export(utils_exports, {
|
|
|
41
41
|
encodeURL: () => encodeURL,
|
|
42
42
|
ensureUrlEncoded: () => ensureUrlEncoded,
|
|
43
43
|
getFileKey: () => getFileKey,
|
|
44
|
-
getFilename: () => getFilename
|
|
44
|
+
getFilename: () => getFilename,
|
|
45
|
+
normalizeStorageSubPath: () => normalizeStorageSubPath,
|
|
46
|
+
resolveStoragePath: () => resolveStoragePath
|
|
45
47
|
});
|
|
46
48
|
module.exports = __toCommonJS(utils_exports);
|
|
47
49
|
var import_utils = require("@nocobase/utils");
|
|
@@ -128,6 +130,41 @@ const diskFilenameGetter = (storage) => (req, file, cb) => {
|
|
|
128
130
|
function getFileKey(record) {
|
|
129
131
|
return (0, import_url_join.default)(record.path || "", record.filename).replace(/^\//, "");
|
|
130
132
|
}
|
|
133
|
+
function pathError(message) {
|
|
134
|
+
const error = new Error(message);
|
|
135
|
+
error.code = "PATH_TRAVERSAL";
|
|
136
|
+
return error;
|
|
137
|
+
}
|
|
138
|
+
function normalizeStoragePathForJoin(value, message, { allowLeadingSlash = false } = {}) {
|
|
139
|
+
if (value == null || value === "") {
|
|
140
|
+
return "";
|
|
141
|
+
}
|
|
142
|
+
if (typeof value !== "string" || value.includes("\0")) {
|
|
143
|
+
throw pathError(message);
|
|
144
|
+
}
|
|
145
|
+
const normalized = value.replace(/\\/g, "/");
|
|
146
|
+
if (!allowLeadingSlash && normalized.startsWith("/")) {
|
|
147
|
+
throw pathError(message);
|
|
148
|
+
}
|
|
149
|
+
const segments = normalized.replace(/^\/+|\/+$/g, "").split("/").filter((segment) => segment && segment !== ".");
|
|
150
|
+
if (segments.some((segment) => segment === "..")) {
|
|
151
|
+
throw pathError("Access denied");
|
|
152
|
+
}
|
|
153
|
+
return segments.join("/");
|
|
154
|
+
}
|
|
155
|
+
function normalizeStorageSubPath(subPath) {
|
|
156
|
+
return normalizeStoragePathForJoin(subPath, "Invalid storage sub path");
|
|
157
|
+
}
|
|
158
|
+
function resolveStoragePath(storagePath, subPath) {
|
|
159
|
+
const normalizedSubPath = normalizeStorageSubPath(subPath);
|
|
160
|
+
if (!normalizedSubPath) {
|
|
161
|
+
return typeof storagePath === "string" ? storagePath : "";
|
|
162
|
+
}
|
|
163
|
+
const normalizedStoragePath = normalizeStoragePathForJoin(storagePath, "Invalid storage path", {
|
|
164
|
+
allowLeadingSlash: true
|
|
165
|
+
});
|
|
166
|
+
return normalizedStoragePath ? `${normalizedStoragePath}/${normalizedSubPath}` : normalizedSubPath;
|
|
167
|
+
}
|
|
131
168
|
function ensureUrlEncoded(value) {
|
|
132
169
|
try {
|
|
133
170
|
if (decodeURIComponent(value) !== value) {
|
|
@@ -157,5 +194,7 @@ function encodeURL(url) {
|
|
|
157
194
|
encodeURL,
|
|
158
195
|
ensureUrlEncoded,
|
|
159
196
|
getFileKey,
|
|
160
|
-
getFilename
|
|
197
|
+
getFilename,
|
|
198
|
+
normalizeStorageSubPath,
|
|
199
|
+
resolveStoragePath
|
|
161
200
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-file-manager",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.62",
|
|
4
4
|
"displayName": "File manager",
|
|
5
5
|
"displayName.ru-RU": "Менеджер файлов",
|
|
6
6
|
"displayName.zh-CN": "文件管理器",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"Collections",
|
|
56
56
|
"Collection fields"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "b21b0a5111d188ba495eb579fdae674c5680fff2"
|
|
59
59
|
}
|