Skip to content

fix(webi): bootstrap fails on Windows usernames with apostrophes or spaces - #1058

Draft
coolaj86 with Copilot wants to merge 2 commits into
mainfrom
copilot/bug-fix-install-webi
Draft

fix(webi): bootstrap fails on Windows usernames with apostrophes or spaces#1058
coolaj86 with Copilot wants to merge 2 commits into
mainfrom
copilot/bug-fix-install-webi

Conversation

Copilot AI commented Mar 12, 2026

Copy link
Copy Markdown

The bootstrap template passed the download path via curl.exe -o "...", which routes through PowerShell's external-program argument quoting. On PS 5.x, paths containing apostrophes or spaces (common in legacy/AD-migrated accounts) are mangled, causing curl to silently not write the file — then & "path.ps1" throws CommandNotFoundException.

Changes

  • _webi/curl-pipe-bootstrap.tpl.ps1
    • Replace curl.exe -o "$Env:USERPROFILE\..." with pipe to Out-File -Encoding utf8, which uses .NET file I/O directly and is immune to PS argument-quoting bugs. Consistent with how webi-pwsh.ps1 handles all its own downloads.
    • Extract path into $b_webi_ps1 variable to avoid duplication.
    • Add post-download guard checking $LASTEXITCODE, Test-Path, and minimum file size — surfaces SSL/network failures as a clear Write-Error instead of the cryptic downstream CommandNotFoundException.
-curl.exe -s -A "windows" "$Env:WEBI_HOST/packages/webi/webi-pwsh.ps1" -o "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1"
-Set-ExecutionPolicy -Scope Process Bypass
-& "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" "{{ exename }}"
+$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
+& "$b_webi_ps1" "{{ exename }}"
Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug] Can't install webi fail to find webi-pwsh.ps1</issue_title>
<issue_description>## What were you trying to install (or what else went wrong)?

I was trying to install webi

What exactly did you do?

I ran curl.exe --ssl-no-revoke https://webi.ms/webi | powershell in an normal command prompt

What went wrong?

 Microsoft Windows [Version 10.0.26200.7705]
(c) Microsoft Corporation. Alle rettigheder forbeholdes.

C:\Users\xxx>curl.exe --ssl-no-revoke https://webi.ms/webi | powershell
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

100   785    0   785    0     0   1333      0 --:--:-- --:--:-- --:--:--  1346
# Download the latest webi, then install webi
PS C:\Users\xxx> # <pre>
PS C:\Users\xxx> ############################################################
PS C:\Users\xxx> # <h1>Cheat Sheet at https://webinstall.dev/webi</h1>
PS C:\Users\xxx> # <meta http-equiv="refresh" content="3; URL='https://webinstall.dev/webi'" />
PS C:\Users\xxx> ############################################################
PS C:\Users\xxx> New-Item -Path "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | Out-Null
PS C:\Users\xxx> New-Item -Path "$Env:USERPROFILE\.local\bin" -ItemType Directory -Force | Out-Null
PS C:\Users\xxx> IF ($null -eq $Env:WEBI_HOST -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = 'https://webi.ms'}
PS C:\Users\xxx> curl.exe -s -A "windows" "$Env:WEBI_HOST/packages/webi/webi-pwsh.ps1" -o "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1"
PS C:\Users\xxx> Set-ExecutionPolicy -Scope Process Bypass
PS C:\Users\xxx> & "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" "webi"
& : The term 'C:\Users\xxx\.local\bin\webi-pwsh.ps1' is not recognized as the name of a cmdlet, function, script file
, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and t
ry again.
At line:1 char:3
+ & "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" "webi"
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\xxx\.local\bin\webi-pwsh.ps1:String) [], CommandNotFoundExce
   ption
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\xxx>
> C:\Users\xxx>

Which OS did you try on?

  • Mac
  • Windows
  • Linux

What type of computer (i.e. laptop, desktop, Raspberry Pi)?

  • Laptop or Desktop (amd64 / x86-64)
  • Raspberry Pi (ARM-64)
  • Other (please specify, if you know)
    </issue_description>

<agent_instructions>Investigate what the nature of this problem might be from the person's description and my comments.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@coolaj86 @kimth86 Does the xxxx in 'C:\Users\xxxx\.local\bin\webi-pwsh.ps1' happen to have a space or apostrophe or other special character? Windows 11 doesn't allow those anymore, but if you've migrated your computer from an older version of Windows or Active Directory, it may have invalid characters.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ad failures

Co-authored-by: coolaj86 <122831+coolaj86@users.noreply.github.com>
Copilot AI changed the title [WIP] [Bug] Fix installation issue with webi-pwsh.ps1 fix(webi): bootstrap fails on Windows usernames with apostrophes or spaces Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Can't install webi fail to find webi-pwsh.ps1

2 participants