Skip to content

Commit 54eaf46

Browse files
Copilotbytemain
andauthored
Use install artifact check in Windows CI
Agent-Logs-Url: https://github.com/version-fox/vfox-python/sessions/5852e539-b06d-4c0c-b5d1-b981726a91d9 Co-authored-by: bytemain <13938334+bytemain@users.noreply.github.com>
1 parent c9d0916 commit 54eaf46

2 files changed

Lines changed: 15 additions & 18 deletions

File tree

.github/workflows/vfox-test.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,14 @@ jobs:
149149
VFOX_PYTHON_USE_UV_BUILD: "1"
150150
run: |
151151
Invoke-Expression "$(vfox activate pwsh)"
152-
$install_output = vfox install python@3.10.20 2>&1
153-
$install_output | Write-Output
154-
if ($LASTEXITCODE -ne 0 -or ($install_output -join "`n") -ilike "*failed to install python*") {
155-
exit 1
152+
vfox install python@3.10.20
153+
if ($LASTEXITCODE -ne 0) {
154+
exit $LASTEXITCODE
155+
}
156+
$python_exe = Join-Path $HOME ".vfox\cache\python\v-3.10.20\python-3.10.20\python.exe"
157+
if (-not (Test-Path $python_exe)) {
158+
Write-Error "python@3.10.20 uv-build install did not create $python_exe"
159+
exit 1
156160
}
157161
vfox use -g python@3.10.20
158162
vfox current

lib/util.lua

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,12 @@ end
230230

231231
local function containsTraversalSegment(value)
232232
local normalizedValue = string.gsub(value, "\\", "/")
233+
local lowerValue = string.lower(normalizedValue)
234+
if string.find(lowerValue, "%%2e", 1, false) then
235+
return true
236+
end
233237
for segment in string.gmatch(normalizedValue, "[^/]+") do
234-
if segment == ".." then
238+
if string.sub(segment, 1, 2) == ".." then
235239
return true
236240
end
237241
end
@@ -256,17 +260,6 @@ local function shellQuote(value)
256260
return "'" .. string.gsub(value, "'", "'\\''") .. "'"
257261
end
258262

259-
local function powershellQuote(value)
260-
if string.find(value, "[\r\n%z]") then
261-
error("Path contains unsupported control character: " .. value)
262-
end
263-
if containsTraversalSegment(value) then
264-
error("Path contains unsupported traversal segment: " .. value)
265-
end
266-
267-
return "'" .. string.gsub(value, "'", "''") .. "'"
268-
end
269-
270263
local function startsWith(value, prefix)
271264
return string.sub(value, 1, string.len(prefix)) == prefix
272265
end
@@ -479,9 +472,9 @@ local function verifyUvBuildArchive(path, sha256)
479472

480473
local status
481474
if RUNTIME.osType == "windows" or OS_TYPE == "windows" then
482-
-- shellQuote quotes for cmd.exe; powershellQuote quotes the archive path inside the PowerShell command.
475+
os.setenv("VFOX_PYTHON_HASH_PATH", path)
483476
local command = "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command " ..
484-
shellQuote("(Get-FileHash -LiteralPath " .. powershellQuote(path) .. " -Algorithm SHA256).Hash")
477+
shellQuote("(Get-FileHash -LiteralPath $env:VFOX_PYTHON_HASH_PATH -Algorithm SHA256).Hash")
485478
local handle = io.popen(command)
486479
if handle == nil then
487480
error("Unable to verify uv-build archive sha256 for " .. path .. ": powershell Get-FileHash command could not be started")

0 commit comments

Comments
 (0)