按规划继续工作
结论:补齐 OPFS G-code 程序文件名的自定义路径与非法遍历/嵌套路径拒绝验证,覆盖 Node OPFS 与 Chromium OPFS 路径,并通过 host/WASM/browser 聚合验证。
This commit is contained in:
@@ -9,7 +9,11 @@
|
||||
<script type="module">
|
||||
import { createLinuxCncIniSdk } from "../../runtime/sdk/src/index.js";
|
||||
import { loadTextFile, saveTextFile } from "../../runtime/opfs/file-service.js";
|
||||
import { machineIniPath, sessionSnapshotPath } from "../../runtime/opfs/path-model.js";
|
||||
import {
|
||||
gcodeProgramPath,
|
||||
machineIniPath,
|
||||
sessionSnapshotPath,
|
||||
} from "../../runtime/opfs/path-model.js";
|
||||
import {
|
||||
loadSessionSnapshot,
|
||||
saveSessionSnapshot,
|
||||
@@ -201,8 +205,25 @@ JOINTS = 3
|
||||
assertEqual(machineFiles.ini, iniText, "machine ini text");
|
||||
assertEqual(machineFiles.toolTable, "T0 P0 ; no tool\n", "tool table text");
|
||||
assertEqual(machineFiles.parameters, "5161 0.0\n", "parameter text");
|
||||
assertEqual(
|
||||
gcodeProgramPath("browser-custom.ngc"),
|
||||
"linuxcnc/gcode/browser-custom.ngc",
|
||||
"custom G-code path",
|
||||
);
|
||||
await saveGcodeProgram("browser-smoke.ngc", "G0 X0 Y0\nM2\n");
|
||||
assertEqual(await loadGcodeProgram("browser-smoke.ngc"), "G0 X0 Y0\nM2\n", "gcode text");
|
||||
await saveGcodeProgram("browser-custom.ngc", "G1 X1 F10\nM2\n");
|
||||
assertEqual(await loadGcodeProgram("browser-custom.ngc"), "G1 X1 F10\nM2\n", "custom gcode text");
|
||||
await assertRejects(
|
||||
"browser G-code invalid filename save",
|
||||
() => saveGcodeProgram("nested/browser.ngc", ""),
|
||||
/Invalid G-code filename/,
|
||||
);
|
||||
await assertRejects(
|
||||
"browser G-code invalid filename load",
|
||||
() => loadGcodeProgram("../escape.ngc"),
|
||||
/Invalid G-code filename/,
|
||||
);
|
||||
|
||||
const uiDocument = await loadUiFrame();
|
||||
await waitFor(
|
||||
|
||||
Reference in New Issue
Block a user