Skip to content

Commit

Permalink
fix(config): Warn users about misconfigured token (#5777)
Browse files Browse the repository at this point in the history
* Warn users about misconfigured token

* Update CHANGELOG.md
  • Loading branch information
rashil2000 authored Jan 5, 2024
1 parent fb31696 commit 5328bef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
- **scoop-reset:** Don't abort when multiple apps are passed and an app is running ([#5687](https://github.com/ScoopInstaller/Scoop/issues/5687))
- **core:** Do not call `scoop` externally from inside the code ([#5695](https://github.com/ScoopInstaller/Scoop/issues/5695))
- **scoop-checkup:** Don't throw 7zip error when external 7zip is used ([#5703](https://github.com/ScoopInstaller/Scoop/issues/5703))
- **config:** Warn users about misconfigured GitHub token ([#5777](https://github.com/ScoopInstaller/Scoop/issues/5777))

### Performance Improvements

Expand Down
12 changes: 11 additions & 1 deletion lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ function Start-Download ($url, $to, $cookies) {
Invoke-Download $url $to $cookies $progress
} catch {
$e = $_.exception
if ($e.Response.StatusCode -eq 'Unauthorized') {
warn "Token might be misconfigured."
}
if($e.innerexception) { $e = $e.innerexception }
throw $e
}
Expand Down Expand Up @@ -246,7 +249,14 @@ function Invoke-CachedAria2Download ($app, $version, $manifest, $architecture, $
} else {
$download_finished = $false
# create aria2 input file content
$urlstxt_content += "$(handle_special_urls $url)`n"
try {
$try_url = handle_special_urls $url
} catch {
if ($_.Exception.Response.StatusCode -eq 'Unauthorized') {
warn "Token might be misconfigured."
}
}
$urlstxt_content += "$try_url`n"
if (!$url.Contains('sourceforge.net')) {
$urlstxt_content += " referer=$(strip_filename $url)`n"
}
Expand Down

0 comments on commit 5328bef

Please sign in to comment.