From 70124a95701f42be7a9c490ffeda72a296585e9a Mon Sep 17 00:00:00 2001 From: Sucukdeluxe <259325684+Sucukdeluxe@users.noreply.github.com> Date: Fri, 14 Aug 2026 15:09:26 +0200 Subject: [PATCH] fix(managed-tools): stage downloaded archives with a .zip extension The installer staged downloaded tool archives as archiveName.uuid, so the temporary file no longer ended in .zip. The Expand-Archive cmdlet shipped with stock Windows PowerShell (Microsoft.PowerShell.Archive 1.0.1.0) rejects any archive whose extension is not .zip, which made every managed streamlink and ffmpeg installation fail with extract-failed on systems without an updated Archive module - including plain end-user machines and the self-hosted CI runner. The unique download path now uses the UUID as a prefix and keeps the manifest archive name with its .zip extension intact. --- src/main/domain/managed-tools.test.ts | 12 ++++++++++++ src/main/domain/managed-tools.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/domain/managed-tools.test.ts b/src/main/domain/managed-tools.test.ts index 6d45ba6..0f81ee4 100644 --- a/src/main/domain/managed-tools.test.ts +++ b/src/main/domain/managed-tools.test.ts @@ -107,6 +107,18 @@ afterEach(() => { }); describe('managed tool installer', () => { + it('stages the downloaded archive under a unique path that keeps the .zip extension', async () => { + const { installer, download } = createInstaller(); + + const result = await installer.repair(manifest()); + + expect(result.success).toBe(true); + expect(download).toHaveBeenCalledTimes(1); + const archivePath = download.mock.calls[0][1]; + expect(path.extname(archivePath)).toBe('.zip'); + expect(path.basename(archivePath)).not.toBe(manifest().archiveName); + }); + it('retains the working installation when the downloaded archive hash is corrupted', async () => { const { installer, installPath, download } = createInstaller({ archiveContents: 'corrupted archive' }); writeExistingInstallation(installPath); diff --git a/src/main/domain/managed-tools.ts b/src/main/domain/managed-tools.ts index 97c1b02..55026b5 100644 --- a/src/main/domain/managed-tools.ts +++ b/src/main/domain/managed-tools.ts @@ -217,7 +217,7 @@ export class ManagedToolInstaller { private async installOnce(manifest: ExternalToolManifest): Promise { const uniqueSuffix = crypto.randomUUID(); - const archivePath = path.join(this.options.temporaryDirectory, `${manifest.archiveName}.${uniqueSuffix}`); + const archivePath = path.join(this.options.temporaryDirectory, `${uniqueSuffix}-${manifest.archiveName}`); const stagingDirectory = `${this.options.installationDirectory}.stage-${uniqueSuffix}`; const diagnostics: string[] = [];