Support Windows paths containing spaces via PowerShell -EncodedCommmand - #32
Closed
linghengqian wants to merge 1 commit into
Closed
linghengqian wants to merge 1 commit into
linghengqian wants to merge 1 commit into
Conversation
-EncodedCommmand-EncodedCommmand
linghengqian
force-pushed
the
ohos
branch
2 times, most recently
from
September 30, 2026 07:44
936ee53 to
077615f
Compare
linghengqian
commented
Sep 30, 2026
linghengqian
left a comment
Member
Author
There was a problem hiding this comment.
- This is a bug in https://github.com/version-fox/vfox itself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows, the plugin passed paths unquoted to
cmd.exe /cbecause Go's argv re-quoting turns"into\", which cmd.exe misinterprets as a volume-relative path (\path\) and rejects with "The filename, directory name, or volume label syntax is incorrect." This meant paths containing spaces (e.g.C:\Users\John Doe\.vfox) were completely unsupported.The previous workaround was to skip quoting entirely — unquoted paths break at the first space. The drift check in
manifest.luasilently failed rather than crashing, and git operations simply didn't work.Solution
Route all path-bearing shell commands through PowerShell's
-EncodedCommand(base64 UTF-16LE). The encoded string contains only[A-Za-z0-9+/=]— no spaces, no quotes — so Go'sEscapeArgcannot mangle it. Inside the PowerShell script, paths are passed as single-quoted strings, which PowerShell handles natively.Changes
lib/git.luapsQuote()for PowerShell single-quote quoting andexecPS()for running scripts via-EncodedCommandgit(),M.removeDir(),makeParentDir(),M.init()now use PowerShell on WindowsprobeWithTimeoutWindowsreusesexecPS, eliminating duplicate base64 codeM.initbatchesgit init+git configinto a single PowerShell scriptlib/manifest.luabase64,utf16le,psQuotehelperscapture()auto-wraps commands in-EncodedCommandon WindowsM.gitRootusesGet-ChildItem -Directoryinstead ofdir /b /adgitRevParse()helper used byM.currentHeadandM.writedocs/ohos.mdtests/e2e/windows/latest-ohos-default-spaces) that setsVFOX_HOMEto a path containing a space, exercising the fix end-to-end