-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(download|scoop-config): Allow disabling automatic fallback to the default downloader #6538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(download|scoop-config): Allow disabling automatic fallback to the default downloader #6538
Conversation
WalkthroughAdds a new configuration option Changes
Sequence DiagramsequenceDiagram
participant User
participant Download as lib/download.ps1
participant Aria2 as aria2c
participant DefaultDL as Default Downloader
User->>Download: start download
Download->>Aria2: run aria2c
Aria2-->>Download: exit (non-zero)
alt aria2-fallback-disabled = true
Download->>Download: log exit code, aria output, urlstxt_content
Download-->>User: abort with generated issue message
else aria2-fallback-disabled = false
Download->>Download: log fallback decision
Download->>DefaultDL: invoke default downloader
DefaultDL-->>Download: download result
Download-->>User: complete (success/failure)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Please add only one chglog item. |
…e default downloader
d0d751c to
ee1882c
Compare
Done.
This change will be moved to #6539. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
lib/download.ps1 (1)
457-479: Consider restructuring with an else block for clarity.While the current implementation works correctly (since
abortterminates execution), wrapping lines 464-479 in anelseblock would make the mutually exclusive control flow more explicit and improve maintainability.if (get_config 'aria2-fallback-disabled') { error "Download failed! (Error $lastexitcode) $(aria_exit_code $lastexitcode)" error $urlstxt_content error $aria2 abort $(new_issue_msg $app $bucket 'download via aria2 failed') + } else { + 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" + } } - - 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" - }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
CHANGELOG.md(1 hunks)lib/download.ps1(1 hunks)libexec/scoop-config.ps1(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- libexec/scoop-config.ps1
- CHANGELOG.md
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-31T01:35:53.228Z
Learnt from: z-Fng
Repo: ScoopInstaller/Scoop PR: 6473
File: libexec/scoop-download.ps1:105-109
Timestamp: 2025-08-31T01:35:53.228Z
Learning: In the Scoop codebase, `Invoke-CachedAria2Download` calls `abort` on failure, which terminates the entire script execution rather than throwing catchable exceptions. Therefore, try-catch blocks around this function are not useful for error handling.
Applied to files:
lib/download.ps1
📚 Learning: 2025-08-31T01:39:35.684Z
Learnt from: z-Fng
Repo: ScoopInstaller/Scoop PR: 6473
File: libexec/scoop-download.ps1:135-135
Timestamp: 2025-08-31T01:39:35.684Z
Learning: In the Scoop codebase, `Invoke-ScoopDownload` in lib/download.ps1 calls `abort` when hash verification fails, which terminates script execution completely rather than trying remaining mirrors. The scoop-download.ps1 script should maintain consistency with this behavior by using `continue app_loop` to skip to the next app rather than trying remaining mirrors for the current app.
Applied to files:
lib/download.ps1
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: PowerShell
Description
This PR makes the following changes:
aria2-fallback-disabledto allow disabling automatic fallback to the default downloader when Aria2c download fails.Related PRs/Issues
How Has This Been Tested?
Checklist
developbranch.Summary by CodeRabbit
New Features
Bug Fixes