fix(installer): extract portable Node with ZipFile · openclaw/openclaw@ffa6cd8
steipete
·
2026-05-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -63,7 +63,7 @@ Docs: https://docs.openclaw.ai
|
63 | 63 | - Plugins/discovery: strip `-plugin` package suffixes when deriving plugin id hints so package names line up with manifest ids. (#85170) Thanks @JulyanXu. |
64 | 64 | - Telegram: preserve fenced code block languages through Markdown rendering so Telegram receives `language-*` code classes. (#85209) Thanks @leno23. |
65 | 65 | - Windows installer: bootstrap a user-local portable Node.js when native Windows has no Node and no winget, Chocolatey, or Scoop, so first-run installs can continue on raw hosts. |
66 | | -- Windows installer: copy the downloaded portable Node.js directory into place so PowerShell 5.1 first-run bootstraps do not fail while moving zip contents. |
| 66 | +- Windows installer: extract and copy the downloaded portable Node.js directory without PowerShell 5.1 `Expand-Archive`/move failures. |
67 | 67 | - fix(integrations): enforce channel read target allowlists [AI]. (#84982) Thanks @pgondhi987. |
68 | 68 | - Agents/heartbeat: route single-owner `session.dmScope=main` direct-message exec and cron event wakes back to the agent main session so async completions no longer strand context in orphan direct-DM queues. Fixes #71581. (#83743) Thanks @Kaspre. |
69 | 69 | - Agents/code-mode: expose outer code-mode `exec` source through the `command` hook alias with `toolKind`/`toolInputKind` discriminators so exec-shaped policies can distinguish code-mode cells. (#83483) Thanks @Kaspre. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -183,6 +183,18 @@ function Resolve-PortableNodeDownload {
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
| 186 | +function Expand-PortableNodeArchive { |
| 187 | +param( |
| 188 | + [Parameter(Mandatory = $true)] |
| 189 | + [string]$ZipPath, |
| 190 | + [Parameter(Mandatory = $true)] |
| 191 | + [string]$DestinationPath |
| 192 | + ) |
| 193 | + |
| 194 | +Add-Type -AssemblyName System.IO.Compression.FileSystem |
| 195 | + [System.IO.Compression.ZipFile]::ExtractToDirectory($ZipPath, $DestinationPath) |
| 196 | +} |
| 197 | + |
186 | 198 | function Install-PortableNode { |
187 | 199 | if (Use-PortableNodeIfPresent) { |
188 | 200 | Ensure-PortableNodeOnUserPath |
@@ -208,12 +220,11 @@ function Install-PortableNode {
|
208 | 220 | if (Test-Path $tmpExtract) { |
209 | 221 | Remove-Item -Recurse -Force $tmpExtract |
210 | 222 | } |
211 | | -New-Item -ItemType Directory -Force -Path $tmpExtract | Out-Null |
212 | 223 | |
213 | 224 | try { |
214 | 225 | Write-Host " Downloading Node.js $($download.Version)..." -ForegroundColor Gray |
215 | 226 | Invoke-WebRequest -UseBasicParsing -Uri $download.Url -OutFile $tmpZip |
216 | | -Expand-Archive -Path $tmpZip -DestinationPath $tmpExtract -Force |
| 227 | +Expand-PortableNodeArchive -ZipPath $tmpZip -DestinationPath $tmpExtract |
217 | 228 | |
218 | 229 | $nodeDir = Get-ChildItem -Path $tmpExtract -Directory | |
219 | 230 | Where-Object { Test-Path (Join-Path $_.FullName "node.exe") } | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -121,6 +121,7 @@ describe("install.ps1 failure handling", () => {
|
121 | 121 | const userPathBody = extractFunctionBody(source, "Add-ToUserPath"); |
122 | 122 | const depsRootBody = extractFunctionBody(source, "Get-OpenClawDepsRoot"); |
123 | 123 | const resolveNodeBody = extractFunctionBody(source, "Resolve-PortableNodeDownload"); |
| 124 | +const expandNodeBody = extractFunctionBody(source, "Expand-PortableNodeArchive"); |
124 | 125 | |
125 | 126 | expect(installNodeBody).toContain("Install-PortableNode"); |
126 | 127 | expect(installNodeBody).toContain("Portable Node.js bootstrap failed"); |
@@ -137,6 +138,10 @@ describe("install.ps1 failure handling", () => {
|
137 | 138 | '[Environment]::SetEnvironmentVariable("Path", $newUserPath, "User")', |
138 | 139 | ); |
139 | 140 | expect(portableNodeBody).toContain("Invoke-WebRequest -UseBasicParsing"); |
| 141 | +expect(portableNodeBody).toContain("Expand-PortableNodeArchive"); |
| 142 | +expect(portableNodeBody).not.toContain("Expand-Archive"); |
| 143 | +expect(portableNodeBody).not.toContain("New-Item -ItemType Directory -Force -Path $tmpExtract"); |
| 144 | +expect(expandNodeBody).toContain("System.IO.Compression.ZipFile"); |
140 | 145 | expect(resolveNodeBody).toContain("https://nodejs.org/dist/index.json"); |
141 | 146 | expect(resolveNodeBody).toContain("win-$architecture-zip"); |
142 | 147 | expect(resolveNodeBody).toContain("node-$($release.version)-win-$architecture.zip"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。