mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-10-30 06:07:56 +00:00
fix(download): Fallback to default downloader when aria2 fails (#4292)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user