fix(artifacts): expand nested ASARs on Windows (#582)

This commit is contained in:
morluto
2026-10-05 23:33:59 +08:00
committed by GitHub
parent 28e0f4e9ec
commit ebb4c45b68
2 changed files with 6 additions and 4 deletions
@@ -1,3 +1,5 @@
import { isAbsolute } from "node:path";
import { import {
ArtifactPathRegistry, ArtifactPathRegistry,
normalizeArtifactPath, normalizeArtifactPath,
@@ -234,7 +236,7 @@ const digestArtifactEntry = async (
const isExpandableAsar = (entry: ArtifactEntry, logicalPath: string): boolean => const isExpandableAsar = (entry: ArtifactEntry, logicalPath: string): boolean =>
entry.kind === "file" && entry.kind === "file" &&
logicalPath.toLowerCase().endsWith(".asar") && logicalPath.toLowerCase().endsWith(".asar") &&
entry.adapterKey.startsWith("/"); isAbsolute(entry.adapterKey);
const isUnavailableUnpackedEntry = ( const isUnavailableUnpackedEntry = (
cause: unknown, cause: unknown,
@@ -1,5 +1,5 @@
import { mkdir, rm, symlink, writeFile } from "node:fs/promises"; 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 { buffer } from "node:stream/consumers";
import { createPackage, listPackage, uncache } from "@electron/asar"; import { createPackage, listPackage, uncache } from "@electron/asar";
@@ -144,7 +144,7 @@ describe("ASAR inventory freshness", () => {
const fixture = await archiveFixture(); const fixture = await archiveFixture();
try { try {
expect(listPackage(fixture.archive, { isPack: false })).toEqual([ expect(listPackage(fixture.archive, { isPack: false })).toEqual([
"/old.js", `${sep}old.js`,
]); ]);
await fixture.replace(); await fixture.replace();
const inventory = await inventoryArtifact(fixture.archive); const inventory = await inventoryArtifact(fixture.archive);
@@ -208,7 +208,7 @@ describe("ASAR inventory freshness", () => {
await fixture.replace(); await fixture.replace();
expect(listPackage(fixture.archive, { isPack: false })).toEqual([ expect(listPackage(fixture.archive, { isPack: false })).toEqual([
"/new.js", `${sep}new.js`,
]); ]);
} finally { } finally {
await entries.return?.(); await entries.return?.();