Skip to content

Commit 9fda542

Browse files
authored
builds(checkver): Support XML default namespace (#5191)
1 parent d0cbc36 commit 9fda542

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
### Builds
1414

1515
- **auto-pr:** Add `CommitMessageFormat` option ([#5171](https://github.com/ScoopInstaller/Scoop/issues/5171))
16+
- **checkver:** Support XML default namespace ([#5191](https://github.com/ScoopInstaller/Scoop/issues/5191))
1617

1718
## [v0.3.0](https://github.com/ScoopInstaller/Scoop/compare/v0.2.4...v0.3.0) - 2022-10-10
1819

bin/checkver.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,17 @@ while ($in_progress -gt 0) {
310310
# Then add them into the NamespaceManager
311311
$nsmgr = New-Object System.Xml.XmlNamespaceManager($xml.NameTable)
312312
$nsList | ForEach-Object {
313-
$nsmgr.AddNamespace($_.LocalName, $_.Value)
313+
if ($_.LocalName -eq 'xmlns') {
314+
$nsmgr.AddNamespace('ns', $_.Value)
315+
$xpath = $xpath -replace '/([^:/]+)((?=/)|(?=$))', '/ns:$1'
316+
} else {
317+
$nsmgr.AddNamespace($_.LocalName, $_.Value)
318+
}
314319
}
315320
# Getting version from XML, using XPath
316321
$ver = $xml.SelectSingleNode($xpath, $nsmgr).'#text'
317322
if (!$ver) {
318-
next "couldn't find '$xpath' in $url"
323+
next "couldn't find '$($xpath -replace 'ns:', '')' in $url"
319324
continue
320325
}
321326
}

0 commit comments

Comments
 (0)