Skip to content

fix(windows): quote Expand-Archive paths for apostrophes#1231

Open
stantheman0128 wants to merge 1 commit into
OpenWhispr:mainfrom
stantheman0128:fix/win-expand-archive-quoting
Open

fix(windows): quote Expand-Archive paths for apostrophes#1231
stantheman0128 wants to merge 1 commit into
OpenWhispr:mainfrom
stantheman0128:fix/win-expand-archive-quoting

Conversation

@stantheman0128

Copy link
Copy Markdown

Summary

On Windows, extractZipWindows fell back to PowerShell Expand-Archive with paths embedded in single quotes via -Path. Paths containing an apostrophe (for example C:\Users\O'Brien\...) break that command, so binary/model zip extraction fails after tar fallback.

This switches to powershell.exe with -LiteralPath and doubles apostrophes for PowerShell single-quoted strings.

AI assistance

Assisted by Cursor / Grok. Human author: Stan Shih (stantheman0128). I reviewed the diff and verification output.

Verification / Evidence

node --test --test-name-pattern "PowerShell|escapePowerShell|falls back to PowerShell|falls back to JS tar|extracts a zip|unzipper" test/helpers/extractArchive.test.js
# 6 pass, 0 fail

# Live Win11 smoke: Expand-Archive -LiteralPath with O''Brien-escaped paths extracts OK
# (pre-existing corrupt-zip test still fails on Windows on origin/main; A/B confirmed)

Test plan

  • Unit tests for Expand-Archive argv + apostrophe escaping
  • Live PowerShell Expand-Archive with apostrophe path (escaped)
  • Manual: download a zip into a user profile path that contains an apostrophe

PowerShell single-quoted -Path embedding broke zip extract when the
user profile path contained an apostrophe. Use -LiteralPath with
doubled apostrophes via powershell.exe.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant