fix(artifacts): refresh cached ASAR headers for each inventory (#574)

This commit is contained in:
Kaoru0822
2026-10-05 21:40:47 +08:00
committed by GitHub
parent eba709e5c0
commit f5013c50ca
2 changed files with 145 additions and 1 deletions
+4 -1
View File
@@ -1,6 +1,6 @@
import { Readable } from "node:stream";
import { extractFile, listPackage, statFile } from "@electron/asar";
import { extractFile, listPackage, statFile, uncache } from "@electron/asar";
import {
ArtifactReaderFailure,
@@ -23,6 +23,8 @@ export class AsarArtifactReader implements ArtifactReader {
async *entries(signal?: AbortSignal): AsyncIterable<ArtifactEntry> {
let paths: string[];
try {
// ASAR caches headers by path even after the archive has been replaced.
uncache(this.path);
paths = listPackage(this.path, { isPack: false }).sort((left, right) =>
left.localeCompare(right, "en"),
);
@@ -103,6 +105,7 @@ export class AsarArtifactReader implements ArtifactReader {
}
close(): Promise<void> {
uncache(this.path);
return Promise.resolve();
}