From 76c957e8d2a8e412edf0be63306f0cd324024234 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 08:35:15 +0000 Subject: [PATCH] fix(webi): handle special chars in USERPROFILE path and detect download failures Co-authored-by: coolaj86 <122831+coolaj86@users.noreply.github.com> --- _webi/curl-pipe-bootstrap.tpl.ps1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/_webi/curl-pipe-bootstrap.tpl.ps1 b/_webi/curl-pipe-bootstrap.tpl.ps1 index b1eadb0..59b91f6 100644 --- a/_webi/curl-pipe-bootstrap.tpl.ps1 +++ b/_webi/curl-pipe-bootstrap.tpl.ps1 @@ -7,6 +7,11 @@ New-Item -Path "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | Out-Null New-Item -Path "$Env:USERPROFILE\.local\bin" -ItemType Directory -Force | Out-Null if ($null -eq $Env:WEBI_HOST -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" } -curl.exe -s -A "windows" "$Env:WEBI_HOST/packages/webi/webi-pwsh.ps1" -o "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" +$b_webi_ps1 = "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" +curl.exe -s -A "windows" "$Env:WEBI_HOST/packages/webi/webi-pwsh.ps1" | Out-File -Encoding utf8 "$b_webi_ps1" +if ($LASTEXITCODE -ne 0 -or -not (Test-Path "$b_webi_ps1") -or (Get-Item "$b_webi_ps1").Length -lt 100) { + Write-Error "error: failed to download '$Env:WEBI_HOST/packages/webi/webi-pwsh.ps1'" + exit 1 +} Set-ExecutionPolicy -Scope Process Bypass -& "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" "{{ exename }}" +& "$b_webi_ps1" "{{ exename }}"