Skip to content

Commit 6efc085

Browse files
committed
fix(software): fall back to 7-Zip when the NanaZip release API is unreachable
Under the module's Set-StrictMode, a null response from the NanaZip releases API (e.g. GitHub unreachable) made $githubApi.Assets throw, skipping the intended 7-Zip fallback. Guard the Assets access so an unreachable API falls back cleanly.
1 parent e7fcbc1 commit 6efc085

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • playbook/Executables/AtlasModules/Scripts/Modules/Atlas.Software/Domain

playbook/Executables/AtlasModules/Scripts/Modules/Atlas.Software/Domain/Installers.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,10 @@ function Install-AtlasArchiveTool {
334334
param([Parameter(Mandatory = $true)][string]$TempDir)
335335

336336
$githubApi = Invoke-RestMethod 'https://api.github.com/repos/M2Team/NanaZip/releases/latest' -ErrorAction SilentlyContinue
337-
$assets = @($githubApi.Assets.browser_download_url | Select-String '.xml', '.msixbundle' | Select-Object -Unique -First 2)
337+
$assets = @()
338+
if ($githubApi -and $githubApi.PSObject.Properties['Assets']) {
339+
$assets = @($githubApi.Assets.browser_download_url | Select-String '.xml', '.msixbundle' | Select-Object -Unique -First 2)
340+
}
338341
$nanaZipInstalled = Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -like '*NanaZip*' }
339342

340343
if ($nanaZipInstalled) {

0 commit comments

Comments
 (0)