fix: 文件/FTP实测修复三处真Bug
- windows-system.ts: File_OpenFile 打开文件夹时 explorer.exe 成功也返回退出码1, 放行该退出码(实测验证) - ftp.ts: FTP_CreateDir 的 cd() 改为 await, 消除 basic-ftp 并发冲突(launched a task while another one is still running, 实测验证) - flowValidation.ts: flow.variables 空值防御, 避免旧流程JSON缺字段时渲染崩溃 实测: FileTest 32/32, FtpTest 10/10 全部通过
This commit is contained in:
parent
f048be792c
commit
bc0ed3fcd8
@ -111,7 +111,9 @@ register("FTP_CreateDir", async (ctx, node, args) => {
|
||||
const client = await requireClient(node.id);
|
||||
const dir = requireText(args, ["dirname"], "目录名", node.id);
|
||||
await client.ensureDir(dir);
|
||||
client.cd(dir).catch(() => {});
|
||||
// 创建后进入该目录;必须 await,否则下个节点的命令与本次 cd 并发,
|
||||
// basic-ftp 会以 "task while another one is still running" 关闭客户端
|
||||
await client.cd(dir).catch(() => {});
|
||||
ctx.log("已创建目录:" + dir, "info", node.id);
|
||||
return { created: true, dir };
|
||||
});
|
||||
|
||||
@ -87,6 +87,12 @@ register("System_SetInputMethodState", async (ctx, node, args) => {
|
||||
|
||||
register("File_OpenFile", async (ctx, node, args) => {
|
||||
const p = reqText(args, ["path"], "文件夹路径", node.id);
|
||||
await run("explorer.exe", [p], { windowsHide: true });
|
||||
try {
|
||||
await run("explorer.exe", [p], { windowsHide: true });
|
||||
} catch (error) {
|
||||
// explorer.exe 打开成功也会返回退出码 1(Windows 已知行为),仅路径不存在时才是真失败
|
||||
const code = (error as { code?: unknown }).code;
|
||||
if (code !== 1) throw error;
|
||||
}
|
||||
return { opened: true, path: p };
|
||||
});
|
||||
|
||||
@ -56,7 +56,7 @@ export function validateFlow(flow: FlowDefinition, catalog: Catalog): FlowValida
|
||||
}
|
||||
|
||||
const definedVars = new Set<string>([
|
||||
...flow.variables.map((item) => item.name),
|
||||
...(flow.variables ?? []).map((item) => item.name),
|
||||
...flow.nodes.map((node) => node.options?.outputVar).filter(Boolean) as string[]
|
||||
]);
|
||||
const variableRef = /\$\{\s*([A-Za-z_\u4e00-\u9fa5][\w\u4e00-\u9fa5]*)\s*(?:\.[A-Za-z_]\w*)?\s*\}/g;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user