From ebb4c45b6892ab60f2c81e05fbb4cb528ffbffc4 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Mon, 5 Oct 2026 23:33:59 +0800 Subject: [PATCH] fix(artifacts): expand nested ASARs on Windows (#582) --- src/application/ArtifactInventory/scanReader.ts | 4 +++- tests/boundary/filesystem/asarInventoryFreshness.test.ts | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/application/ArtifactInventory/scanReader.ts b/src/application/ArtifactInventory/scanReader.ts index 27dceaf0b..fd7c996e1 100644 --- a/src/application/ArtifactInventory/scanReader.ts +++ b/src/application/ArtifactInventory/scanReader.ts @@ -1,3 +1,5 @@ +import { isAbsolute } from "node:path"; + import { ArtifactPathRegistry, normalizeArtifactPath, @@ -234,7 +236,7 @@ const digestArtifactEntry = async ( const isExpandableAsar = (entry: ArtifactEntry, logicalPath: string): boolean => entry.kind === "file" && logicalPath.toLowerCase().endsWith(".asar") && - entry.adapterKey.startsWith("/"); + isAbsolute(entry.adapterKey); const isUnavailableUnpackedEntry = ( cause: unknown, diff --git a/tests/boundary/filesystem/asarInventoryFreshness.test.ts b/tests/boundary/filesystem/asarInventoryFreshness.test.ts index 5c88bbd34..bd867aa68 100644 --- a/tests/boundary/filesystem/asarInventoryFreshness.test.ts +++ b/tests/boundary/filesystem/asarInventoryFreshness.test.ts @@ -1,5 +1,5 @@ import { mkdir, rm, symlink, writeFile } from "node:fs/promises"; -import { join } from "node:path"; +import { join, sep } from "node:path"; import { buffer } from "node:stream/consumers"; import { createPackage, listPackage, uncache } from "@electron/asar"; @@ -144,7 +144,7 @@ describe("ASAR inventory freshness", () => { const fixture = await archiveFixture(); try { expect(listPackage(fixture.archive, { isPack: false })).toEqual([ - "/old.js", + `${sep}old.js`, ]); await fixture.replace(); const inventory = await inventoryArtifact(fixture.archive); @@ -208,7 +208,7 @@ describe("ASAR inventory freshness", () => { await fixture.replace(); expect(listPackage(fixture.archive, { isPack: false })).toEqual([ - "/new.js", + `${sep}new.js`, ]); } finally { await entries.return?.();