Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(deps): run freshness check from escaped paths

morluto8a1c128b67ee
diff --git a/scripts/check-dependency-install.mjs b/scripts/check-dependency-install.mjs
index e3b9fbffd..dcdbd64dd 100644
--- a/scripts/check-dependency-install.mjs
+++ b/scripts/check-dependency-install.mjs
@@ -1,5 +1,6 @@
import { readFile } from "node:fs/promises";
import { resolve } from "node:path";
+import { fileURLToPath } from "node:url";
const REMEDIATION = "Run `npm ci`, then retry.";
@@ -57,4 +58,4 @@ const main = async () => {
}
};
-if (process.argv[1] === new URL(import.meta.url).pathname) await main();
+if (process.argv[1] === fileURLToPath(import.meta.url)) await main();
diff --git a/tests/dependencyInstall.test.ts b/tests/dependencyInstall.test.ts
index 46e6da91e..ad3a85cfd 100644
--- a/tests/dependencyInstall.test.ts
+++ b/tests/dependencyInstall.test.ts
@@ -1,4 +1,4 @@
-import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
+import { copyFile, mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { spawnSync } from "node:child_process";
@@ -79,4 +79,20 @@ describe("dependency install freshness", () => {
);
expect(result.stderr.match(/npm ci/gu)).toHaveLength(1);
});
+
+ it("runs from a script path containing URL-escaped characters", async () => {
+ const root = await fixture("0.9.0");
+ const scriptDirectory = join(root, "path with spaces");
+ const copiedScript = join(scriptDirectory, "check-dependency-install.mjs");
+ await mkdir(scriptDirectory);
+ await copyFile(script, copiedScript);
+
+ const result = spawnSync(process.execPath, [copiedScript], {
+ cwd: root,
+ encoding: "utf8",
+ });
+
+ expect(result.status).toBe(1);
+ expect(result.stderr).toContain("alpha: installed 0.9.0, expected 1.0.0");
+ });
});