Skip to content

Commit

Permalink
fix(scoop-search): Catch error of parsing invalid manifest (ScoopInst…
Browse files Browse the repository at this point in the history
  • Loading branch information
chawyehsu authored and brian6932 committed Jun 1, 2024
1 parent d4bc557 commit 039973b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libexec/scoop-search.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,15 @@ function search_bucket($bucket, $query) {
$apps = Get-ChildItem (Find-BucketDirectory $bucket) -Filter '*.json' -Recurse

$apps | ForEach-Object {
$json = [System.Text.Json.JsonDocument]::Parse([System.IO.File]::ReadAllText($_.FullName))
$filepath = $_.FullName

$json = try {
[System.Text.Json.JsonDocument]::Parse([System.IO.File]::ReadAllText($filepath))
} catch {
debug "Failed to parse manifest file: $filepath (error: $_)"
return
}

$name = $_.BaseName

if ($name -match $query) {
Expand Down

0 comments on commit 039973b

Please sign in to comment.