mirror of
https://github.com/morluto/rea.git
synced 2026-10-26 17:35:11 +00:00
fix(target): recognize binary plists by magic under any extension (#2133)
Target resolution admitted a property list only when its name ended in .plist, so keyed archives with other extensions (for example .archive) were rejected as an unsupported binary format before any plist tool ran. Classify bplist00 bytes as a plist, as the artifact inventory already does. Fixes #2129 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fe4b94a661
commit
672bdea21f
2 files changed
+14
No files matched your search
@@ -294,6 +294,9 @@ const detectArtifactFormat = async (
|
||||
if (lower.endsWith(".app")) return "app-pack";
|
||||
return zipPackageFormatForPath(lower) ?? "zip";
|
||||
}
|
||||
// Binary plists, including keyed archives, often use other extensions.
|
||||
if (observed.bytesRead === 8 && magic.equals(Buffer.from("bplist00")))
|
||||
return "plist";
|
||||
const named = namedArtifactFormat(lower);
|
||||
if (named !== undefined) return named;
|
||||
if (
|
||||
|
||||
@@ -245,6 +245,17 @@ describe("binary target I/O: package classification", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("classifies a binary plist by its magic under any extension", async () => {
|
||||
const directory = await createTestTempDirectory("rea-bplist-target-");
|
||||
const path = join(directory, "Model.archive");
|
||||
await writeFile(path, buildBinary({ $archiver: "NSKeyedArchiver" }));
|
||||
const result = await parseBinaryTarget(path);
|
||||
expect(result.ok && result.value).toMatchObject({
|
||||
kind: "artifact",
|
||||
format: "plist",
|
||||
});
|
||||
});
|
||||
|
||||
it("does not trust a ZIP-family extension without ZIP magic", async () => {
|
||||
const directory = await createTestTempDirectory("rea-fake-archive-");
|
||||
const path = join(directory, "fake.zip");
|
||||
|
||||
Reference in new issue
Block a user