Skip to content

Commit 9385ea0

Browse files
fix corpus fixture blob and tag decode lint
Inline percent-escape hex parsing in the tag URI decoder to satisfy source linting and recommit the yaml-test-suite release archive as binary bytes so the pinned SHA-256 matches in CI and module-local conformance runs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent b54d6bd commit 9385ea0

2 files changed

Lines changed: 3 additions & 12 deletions

File tree

src/functions/private/ConvertFrom-YamlTagUriEscape.ps1

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ function ConvertFrom-YamlTagUriEscape {
1616
[string] $Token
1717
)
1818

19-
function Get-YamlHexNibble {
20-
param ([char] $Character)
21-
if ($Character -notmatch '^[0-9A-Fa-f]$') {
22-
return -1
23-
}
24-
[System.Convert]::ToInt32([string] $Character, 16)
25-
}
26-
2719
$builder = [System.Text.StringBuilder]::new()
2820
$escapedBytes = [System.Collections.Generic.List[byte]]::new()
2921
$utf8 = [System.Text.UTF8Encoding]::new($false, $true)
@@ -50,14 +42,13 @@ function ConvertFrom-YamlTagUriEscape {
5042
"The tag token '$Token' contains a malformed percent escape."
5143
))
5244
}
53-
$high = Get-YamlHexNibble -Character $Text[$index + 1]
54-
$low = Get-YamlHexNibble -Character $Text[$index + 2]
55-
if ($high -lt 0 -or $low -lt 0) {
45+
$pair = '{0}{1}' -f $Text[$index + 1], $Text[$index + 2]
46+
if ($pair -cnotmatch '^[0-9A-Fa-f]{2}$') {
5647
throw (New-YamlException -Start $Mark -End $Mark -ErrorId 'YamlInvalidTag' -Message (
5748
"The tag token '$Token' contains a malformed percent escape."
5849
))
5950
}
60-
$escapedBytes.Add([byte](($high * 16) + $low))
51+
$escapedBytes.Add([System.Convert]::ToByte($pair, 16))
6152
$index += 2
6253
}
6354

Binary file not shown.

0 commit comments

Comments
 (0)