fix(artifacts): compare package signatures without ASCII folding (#2069)

This commit is contained in:
xin zhuang
2026-10-12 15:18:03 +08:00
committed by GitHub
parent b3dec005bc
commit 75a4a14fa0
3 changed files with 39 additions and 4 deletions
+2 -2
View File
@@ -152,7 +152,7 @@ const classifyRootFormat = async (
if (hasZipSignature(prefix)) return zipRootPackageFormat(lower);
if (
lower.endsWith(".pkg") &&
prefix.subarray(0, 4).toString("ascii") === "xar!"
prefix.subarray(0, 4).equals(Buffer.from("xar!"))
)
return "pkg";
if (lower.endsWith(".dmg") && (await hasKolyTrailer(handle))) return "dmg";
@@ -172,5 +172,5 @@ const hasKolyTrailer = async (handle: FileHandle): Promise<boolean> => {
if (size < 512) return false;
const trailer = Buffer.alloc(4);
const read = await handle.read(trailer, 0, trailer.length, size - 512);
return read.bytesRead === 4 && trailer.toString("ascii") === "koly";
return read.bytesRead === 4 && trailer.equals(Buffer.from("koly"));
};