diff --git a/CHANGELOG.md b/CHANGELOG.md index 1547a917..76c04c96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Bug Fixes +- **scoop-download|install|update:** Fallback to default downloader when aria2 fails ([#4292](https://github.com/ScoopInstaller/Scoop/issues/4292)) - **decompress**: `Expand-7zipArchive` only delete temp dir / `$extractDir` if it is empty ([#6092](https://github.com/ScoopInstaller/Scoop/issues/6092)) ### Code Refactoring diff --git a/lib/download.ps1 b/lib/download.ps1 index d162fb61..70641cca 100644 --- a/lib/download.ps1 +++ b/lib/download.ps1 @@ -138,7 +138,7 @@ function Invoke-Download ($url, $to, $cookies, $progress) { # Handle manual file rename if ($url -like '*#/*') { $null, $postfix = $url -split '#/' - $newUrl = "$newUrl#/$postfix" + $newUrl = "$newUrl`#/$postfix" } Invoke-Download $newUrl $to $cookies $progress @@ -454,10 +454,21 @@ function Invoke-CachedAria2Download ($app, $version, $manifest, $architecture, $ Write-Host '' if ($lastexitcode -gt 0) { - error "Download failed! (Error $lastexitcode) $(aria_exit_code $lastexitcode)" - error $urlstxt_content - error $aria2 - abort $(new_issue_msg $app $bucket 'download via aria2 failed') + warn "Download failed! (Error $lastexitcode) $(aria_exit_code $lastexitcode)" + warn $urlstxt_content + warn $aria2 + warn $(new_issue_msg $app $bucket "download via aria2 failed") + + Write-Host "Fallback to default downloader ..." + + try { + foreach ($url in $urls) { + Invoke-CachedDownload $app $version $url "$($data.$url.target)" $cookies $use_cache + } + } catch { + Write-Host $_ -ForegroundColor DarkRed + abort "URL $url is not valid" + } } # remove aria2 input file when done