Skip to content

Commit 53bacf7

Browse files
committed
fix double-encode of keys
1 parent cd52aab commit 53bacf7

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed
76 Bytes
Binary file not shown.

src/UrlQueryStringParser/UrlQueryStringParser.psm1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ function ConvertTo-UrlQueryString {
3434
$result += if (-not $ContinuationOfString) {"?"}
3535
}
3636
foreach($key in $Members.Keys) {
37-
$key = [uri]::EscapeDataString($key.ToString())
3837
$foundValue = $Members[$key]
3938

4039
# Truthy values (or, as a special-case, empty string '') are included in the dict.

test/Test-UrlQueryStringParser.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ if ((ConvertTo-UrlQueryString @{foo='bar baz quux'} -DoMinimalEncode) -ne "?foo
3131
throw "Skip encoding spaces failed."
3232
}
3333

34+
if ((ConvertTo-UrlQueryString @{'$foo'='bar'}) -ne "?%24foo=bar") {
35+
throw "Encoding `$ in key failed."
36+
}
37+
38+
if ((ConvertTo-UrlQueryString @{'$foo'='bar'} -DoMinimalEncode) -ne "?`$foo=bar") {
39+
throw "Skip encoding `$ in key failed."
40+
}
41+
3442
if ((ConvertTo-UrlQueryString ([ordered]@{
3543
allow = 'example equals= colon: at@ slash/ brackets[[] dollar$ comma, semicolon; question? parens()) star* exclaim! space space'
3644
disallow = "example hash# ampersand& percent% plus+ tab`t linebreak`r`n "

0 commit comments

Comments
 (0)