@@ -15,6 +15,7 @@ local version_vault_url = "https://vault.vfox.dev/python/pyenv"
1515local uv_build_vault_url = " https://vault.vfox.dev/python/uv-build"
1616local UV_BUILD_GITHUB_RELEASE_PATTERN = " /releases/download/([^/]+)/([^/]+)$"
1717local SHA256_HEX_LENGTH = 64
18+ local URL_ENCODED_DOT = " %2e"
1819
1920-- request headers
2021local REQUEST_HEADERS = {
231232local function containsTraversalSegment (value )
232233 local normalizedValue = string.gsub (value , " \\ " , " /" )
233234 local lowerValue = string.lower (normalizedValue )
234- if string.find (lowerValue , " %2e " , 1 , true ) then
235+ if string.find (lowerValue , URL_ENCODED_DOT , 1 , true ) then
235236 return true
236237 end
237238 for segment in string.gmatch (normalizedValue , " [^/]+" ) do
@@ -472,9 +473,9 @@ local function verifyUvBuildArchive(path, sha256)
472473
473474 local status
474475 if RUNTIME .osType == " windows" or OS_TYPE == " windows" then
476+ local getFileHashScript = " & { param([string]$p) (Get-FileHash -LiteralPath $p -Algorithm SHA256).Hash }"
475477 local command = " powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command " ..
476- shellQuote (" & { param([string]$p) (Get-FileHash -LiteralPath $p -Algorithm SHA256).Hash }" ) ..
477- " " .. shellQuote (path )
478+ shellQuote (getFileHashScript ) .. " " .. shellQuote (path )
478479 local handle = io.popen (command )
479480 if handle == nil then
480481 error (" Unable to verify uv-build archive sha256 for " .. path .. " : powershell Get-FileHash command could not be started" )
0 commit comments