Skip to content

Commit f65925c

Browse files
committed
fix: use line-by-line Select-String for checksum lookup in install.ps1
Get-Content -Raw returns the file as a single string, so Select-String treated it as one line and ^ only matched the start of the file. Reading line by line allows ^ to anchor correctly per line.
1 parent 0b49cf1 commit f65925c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

install.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ if ($currentVer -eq $UvVersion) {
5353
New-Item -ItemType Directory -Force -Path $Prefix | Out-Null
5454
$tmp = [IO.Path]::Combine([IO.Path]::GetTempPath(), [IO.Path]::ChangeExtension([IO.Path]::GetRandomFileName(), ".zip"))
5555
$tmpDir = "$tmp.dir"
56-
$tomlContent = Get-Content (Join-Path $ScriptDir "distro.toml") -Raw
57-
$expectedHash = ($tomlContent | Select-String "^${arch}-pc-windows-msvc\s*=\s*`"([^`"]+)`"").Matches[0].Groups[1].Value.ToUpper()
56+
$tomlMatch = Get-Content (Join-Path $ScriptDir "distro.toml") |
57+
Select-String "^${arch}-pc-windows-msvc\s*=\s*`"([^`"]+)`""
58+
$expectedHash = $tomlMatch.Matches[0].Groups[1].Value.ToUpper()
5859
if (-not $expectedHash) {
5960
Write-Error "No pinned checksum for ${arch}-pc-windows-msvc in distro.toml"
6061
exit 1

0 commit comments

Comments
 (0)