Skip to content

Commit 947f4a4

Browse files
committed
fix(scoop-search): Catch error of parsing invalid manifest (#5930)
1 parent d285bb0 commit 947f4a4

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [Unreleased](https://github.com/ScoopInstaller/Scoop/compare/master...develop)
2+
3+
### Bug Fixes
4+
5+
- **scoop-search:** Catch error of parsing invalid manifest ([#5930](https://github.com/ScoopInstaller/Scoop/issues/5930))
6+
17
## [v0.4.1](https://github.com/ScoopInstaller/Scoop/compare/v0.4.0...v0.4.1) - 2024-04-25
28

39
### Bug Fixes

libexec/scoop-search.ps1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,15 @@ function search_bucket($bucket, $query) {
6565
$apps = Get-ChildItem (Find-BucketDirectory $bucket) -Filter '*.json' -Recurse
6666

6767
$apps | ForEach-Object {
68-
$json = [System.Text.Json.JsonDocument]::Parse([System.IO.File]::ReadAllText($_.FullName))
68+
$filepath = $_.FullName
69+
70+
$json = try {
71+
[System.Text.Json.JsonDocument]::Parse([System.IO.File]::ReadAllText($filepath))
72+
} catch {
73+
debug "Failed to parse manifest file: $filepath (error: $_)"
74+
return
75+
}
76+
6977
$name = $_.BaseName
7078

7179
if ($name -match $query) {

0 commit comments

Comments
 (0)