Skip to content

Commit

Permalink
fix: Ensure checksums are always defined when requested
Browse files Browse the repository at this point in the history
  • Loading branch information
Thilas committed Mar 22, 2024
1 parent dfe0646 commit a790e3a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Public/Update-Package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@ function Update-Package {
$Env:ChocolateyPackageVersion = $global:Latest.Version.ToString()
$Env:ChocolateyAllowEmptyChecksums = 'true'
foreach ($a in $arch) {
"Checking hash for $a bit version..." | result
$Env:chocolateyForceX86 = if ($a -eq '32') { 'true' } else { '' }
try {
#rm -force -recurse -ea ignore $pkg_path
.\tools\chocolateyInstall.ps1 | result
} catch {
if ( "$_" -notlike 'au_break: *') { throw $_ } else {
if ( "$_" -notlike 'au_break: *') { throw } else {
$filePath = "$_" -replace 'au_break: '
if (!(Test-Path $filePath)) { throw "Can't find file path to checksum" }

Expand All @@ -153,6 +154,10 @@ function Update-Package {
}
}
}
# Sanity check: ensure checksum is defined (rare bug!)
if (!$global:Latest.Item('Checksum' + $a)) {
throw "Hash for $a bit version is missing."
}
}
}

Expand Down

0 comments on commit a790e3a

Please sign in to comment.