Skip to content

Commit 874e8e6

Browse files
authored
fix(checkver): Fix incorrect version returned when script fails without output (#6547)
1 parent f2ee3f9 commit 874e8e6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- **core|manifest:** Avoid error messages when searching non-existent 'deprecated' directory ([#6471](https://github.com/ScoopInstaller/Scoop/issues/6471))
2323
- **path:** Trim ending slash when initializing paths ([#6501](https://github.com/ScoopInstaller/Scoop/issues/6501))
2424
- **checkver:** Allow script to run when URL fetch fails but script exists ([#6490](https://github.com/ScoopInstaller/Scoop/issues/6490))
25+
- **checkver:** Fix incorrect version returned when script fails without output ([#6547](https://github.com/ScoopInstaller/Scoop/issues/6547))
2526
- **uninstall:** Import `url_filename` from `download.ps1` ([#6530](https://github.com/ScoopInstaller/Scoop/issues/6530))
2627
- **schema:** Add missing `hash.mode` value `github` ([#6533](https://github.com/ScoopInstaller/Scoop/issues/6533))
2728
- **core:** Skip NO_JUNCTION logic when $app is 'scoop' in `currentdir` function ([#6541](https://github.com/ScoopInstaller/Scoop/issues/6541))

bin/checkver.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ while ($in_progress -gt 0) {
274274
$expected_ver = $json.version
275275
$ver = $Version
276276

277+
$matchesHashtable = @{}
278+
277279
if (!$ver) {
278280
if (!$regexp -and $replace) {
279281
next "'replace' requires 're' or 'regex'"
@@ -305,6 +307,11 @@ while ($in_progress -gt 0) {
305307
$source = 'the output of script'
306308
}
307309

310+
if ($null -eq $page) {
311+
next "couldn't retrieve content from $source"
312+
continue
313+
}
314+
308315
if ($jsonpath) {
309316
# Return only a single value if regex is absent
310317
$noregex = [String]::IsNullOrEmpty($regexp)
@@ -363,7 +370,6 @@ while ($in_progress -gt 0) {
363370
}
364371

365372
if ($match -and $match.Success) {
366-
$matchesHashtable = @{}
367373
$re.GetGroupNames() | ForEach-Object { $matchesHashtable.Add($_, $match.Groups[$_].Value) }
368374
$ver = $matchesHashtable['1']
369375
if ($replace) {

0 commit comments

Comments
 (0)