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:
Kaoru0822andClaude Opus 5.5 authored and GitHub committed 2026-10-12 19:09:53 +08:00
1 parent fe4b94a661
commit 672bdea21f
2 files changed
+14

No files matched your search

+3
View File
@@ -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");