bnpanel 0.6.3 → 0.6.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/index.js +9 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -10301,6 +10301,15 @@ function createPanelApp(options = {}) {
|
|
|
10301
10301
|
} else {
|
|
10302
10302
|
try {
|
|
10303
10303
|
const target = path14.isAbsolute(raw) ? raw : path14.resolve(raw);
|
|
10304
|
+
const trim = (p2) => p2.replace(/[\\/]+$/, "").toLowerCase();
|
|
10305
|
+
const picked = trim(target);
|
|
10306
|
+
const panelRoot = trim(path14.resolve(paths.root));
|
|
10307
|
+
if (picked === panelRoot || picked.startsWith(`${panelRoot}${path14.sep}`)) {
|
|
10308
|
+
return send(res, 400, { error: "\u4E0D\u80FD\u9009\u9762\u677F\u6570\u636E\u76EE\u5F55\uFF08DSH-PANEL\uFF09\u6216\u5176\u5B50\u76EE\u5F55\uFF0C\u8BF7\u6362\u4E00\u4E2A\u72EC\u7ACB\u6587\u4EF6\u5939\uFF0C\u4F8B\u5982 D:\\BiuNow" });
|
|
10309
|
+
}
|
|
10310
|
+
if (trim(path14.parse(target).root) === picked) {
|
|
10311
|
+
return send(res, 400, { error: "\u4E0D\u80FD\u76F4\u63A5\u9009\u78C1\u76D8\u6839\u76EE\u5F55\uFF0C\u8BF7\u5728\u5176\u4E0B\u65B0\u5EFA\u4E00\u4E2A\u6587\u4EF6\u5939" });
|
|
10312
|
+
}
|
|
10304
10313
|
fs14.mkdirSync(target, { recursive: true });
|
|
10305
10314
|
const probe = path14.join(target, `.bnpanel-write-test-${Date.now()}`);
|
|
10306
10315
|
fs14.writeFileSync(probe, "ok");
|