Skip to content

fix(windows): quote Expand-Archive fallback paths that contain apostrophes - #2031

Merged
Chadpiha merged 1 commit into
OpenWhispr:mainfrom
stantheman0128:fix/expand-archive-apostrophe-paths
Sep 16, 2026
Merged

Chadpiha merged 1 commit into
OpenWhispr:mainfrom
stantheman0128:fix/expand-archive-apostrophe-paths

Conversation

@stantheman0128

Copy link
Copy Markdown
Contributor

Windows zip extract tries tar first, then PowerShell Expand-Archive. The fallback still interpolates -Path '${zipPath}'. An apostrophe in the profile path closes that string early, so Expand-Archive looks for a drive named Brien-... and GPU/binary install fails (gpuBinaryManager uses this helper).

This keeps tar as the primary path. The fallback now uses -LiteralPath and doubles apostrophes inside the single-quoted command.

Fixes #2030

Test plan

  • node --import tsx --test test/helpers/extractArchive.test.js on Win11
  • Command-string test for O'Brien (O''Brien in the -Command)
  • Live extract under %TEMP%\O'Brien-extract-* with tar forced to fail
  • Ubuntu CI npm test (the live apostrophe extract is skipped there)

Evidence

HEAD command against C:\Users\stans\AppData\Local\Temp\O'Brien-ow-extract\binary.zip:

OLD_RC 1
OLD_STDERR New-Item : Cannot find drive. A drive with the name 'Brien-ow-extract\binary.zip -DestinationPath C' does not exist.

Same zip with -LiteralPath and doubled ':

NEW_RC 0
NEW_FILES ...\out-new\test-file.txt

After the helper change, the Windows live test extracted hello from test. 6 passed in that file; the remaining fail is the Linux unzip corrupt-zip case (pre-existing on Win32, CI is ubuntu).

AI assistance

Drafted with Cursor. I reproduced the fallback on this Win11 box and wrote the quoting change plus tests.

@Chadpiha Chadpiha left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the extraction fallback and traced its callers through the GPU download/install flows. Escaping both paths and using -LiteralPath addresses the reported apostrophe-path failure while preserving tar-first behavior and existing extraction routes. No blocking findings.
Thanks @stantheman0128 !

@Chadpiha
Chadpiha merged commit 35a55c5 into OpenWhispr:main Sep 16, 2026
9 checks passed
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.

Windows zip fallback fails when the user path contains an apostrophe

2 participants