diff --git a/CHANGELOG.md b/CHANGELOG.md index d6e1f79248..6e43e4107c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [Unreleased](https://github.com/ScoopInstaller/Scoop/compare/master...develop) + +### Bug Fixes + +- **scoop-search:** Catch error of parsing invalid manifest ([#5930](https://github.com/ScoopInstaller/Scoop/issues/5930)) + ## [v0.4.1](https://github.com/ScoopInstaller/Scoop/compare/v0.4.0...v0.4.1) - 2024-04-25 ### Bug Fixes diff --git a/libexec/scoop-search.ps1 b/libexec/scoop-search.ps1 index a9013afd02..e112ff61f8 100644 --- a/libexec/scoop-search.ps1 +++ b/libexec/scoop-search.ps1 @@ -65,7 +65,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) {