Skip to content

Commit

Permalink
fix(manifest): Fix bugs in 'Get-Manifest()' (#4986)
Browse files Browse the repository at this point in the history
  • Loading branch information
niheaven authored Jun 14, 2022
1 parent 6e25e44 commit 0b38c91
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- **core:** Add `Get-Encoding` function to fix missing webclient encoding ([#4956](https://github.com/ScoopInstaller/Scoop/issues/4956))

### Bug Fixes

- **manifest:** Fix bugs in 'Get-Manifest()' ([#4986](https://github.com/ScoopInstaller/Scoop/issues/4986))

## [v0.2.1](https://github.com/ScoopInstaller/Scoop/compare/v0.2.0...v0.2.1) - 2022-06-10

### Features
Expand Down
8 changes: 6 additions & 2 deletions lib/depends.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Get-Dependency {
$Unresolved = @()
)
process {
$AppName, $manifest, $bucket, $null = Get-Manifest $AppName
$AppName, $manifest, $bucket, $url = Get-Manifest $AppName
$Unresolved += $AppName

if (!$manifest) {
Expand All @@ -57,7 +57,11 @@ function Get-Dependency {
if ($bucket) {
$Resolved += "$bucket/$AppName"
} else {
$Resolved += $AppName
if ($url) {
$Resolved += $url
} else {
$Resolved += $AppName
}
}
if ($Unresolved.Length -eq 0) {
return $Resolved
Expand Down
2 changes: 2 additions & 0 deletions lib/manifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function url_manifest($url) {

function Get-Manifest($app) {
$bucket, $manifest, $url = $null
$app = $app.TrimStart('/')
# check if app is a URL or UNC path
if ($app -match '^(ht|f)tps?://|\\\\') {
$url = $app
Expand All @@ -45,6 +46,7 @@ function Get-Manifest($app) {
if (!$manifest) {
# couldn't find app in buckets: check if it's a local path
$appPath = $app
$bucket = $null
if (!$appPath.EndsWith('.json')) {
$appPath += '.json'
}
Expand Down
2 changes: 1 addition & 1 deletion libexec/scoop-download.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ foreach ($curr_app in $apps) {
$bucket = $version = $app = $manifest = $url = $null

$app, $bucket, $version = parse_app $curr_app
$app, $manifest, $bucket, $url = Get-Manifest $curr_app
$app, $manifest, $bucket, $url = Get-Manifest "$bucket/$app"

info "Starting download for $app..."

Expand Down

0 comments on commit 0b38c91

Please sign in to comment.