diff --git a/packages/rpa-core/src/capabilities/files.ts b/packages/rpa-core/src/capabilities/files.ts index aeb7f94..f594bd2 100644 --- a/packages/rpa-core/src/capabilities/files.ts +++ b/packages/rpa-core/src/capabilities/files.ts @@ -246,6 +246,10 @@ register("File_CompressFile", async (_ctx, node, args) => { register("File_DecompressFile", async (_ctx, node, args) => { const source = requirePath(pick(args, ["folder_path", "path", "zip_path"]), "压缩包路径", node.id, node.componentId); + // adm-zip 对不存在的文件抛 "ADM-ZIP: Invalid filename",极具误导性;先显式检查文件存在性 + await fs.access(source).catch(() => { + throw new RuntimeError("file_not_found", `压缩包不存在:${source}`, { nodeId: node.id, componentId: node.componentId, recommendation: "确认压缩包实际产物路径(压缩组件默认在原文件名后追加 .zip,如 a.txt 会压成 a.txt.zip),或用压缩节点的输出变量传入" }); + }); const saveToSourceDir = String(args.direct_type ?? "1") !== "0"; const target = saveToSourceDir ? path.dirname(source)