fix: redact remaining file and config refusal echoes (#1873)
This commit is contained in:
1 parent
e9a079fcc4
commit
307fe928ac
31 files changed
+415
-51
No files matched your search
@@ -193,9 +193,10 @@ try {
|
||||
readNotifyConfig(system.dataRoot, id);
|
||||
say("NOTIFY", "ok");
|
||||
} catch (e) { say("NOTIFY", "bad", e.message.split("\n")[0]); }
|
||||
const { parseJsonFileText } = await import(`${repo}/packages/organization/src/util.mjs`);
|
||||
const file = businessFilePath(id);
|
||||
let raw;
|
||||
try { raw = JSON.parse(readFileSync(file, "utf8")); } catch (e) { say("BUSINESS", "bad", `cannot read ${file}: ${e.code ?? e.message}`); process.exit(0); }
|
||||
try { raw = parseJsonFileText(readFileSync(file, "utf8"), file); } catch (e) { say("BUSINESS", "bad", `cannot read ${file}: ${e.code ?? "not valid JSON"}`); process.exit(0); }
|
||||
const library = Object.entries(raw?.projects ?? {}).filter(([, p]) => p && p.kind === "library").map(([k]) => k);
|
||||
if (library.length) say("LIBRARY", library.join(","));
|
||||
let b;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
* - No secrets in mission/task data or run records.
|
||||
*/
|
||||
|
||||
import { parseJsonFileText } from "../packages/organization/src/util.mjs";
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
@@ -74,9 +75,9 @@ function readJsonFile(file, what) {
|
||||
}
|
||||
let document;
|
||||
try {
|
||||
document = JSON.parse(fs.readFileSync(file, "utf8"));
|
||||
} catch (error) {
|
||||
fail(2, `${what} is not valid JSON (${file}): ${error.message}`);
|
||||
document = parseJsonFileText(fs.readFileSync(file, "utf8"), file, what);
|
||||
} catch {
|
||||
fail(2, `${what} is not valid JSON (${file})`);
|
||||
}
|
||||
return document;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user