Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6ccacdf

Browse filesBrowse files
watildeaddaleax
authored andcommitted
querystring: manage percent character at unescape
Related: #33892 Fixes: #35012 PR-URL: #35013 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 0f61020 commit 6ccacdf
Copy full SHA for 6ccacdf

File tree

Expand file treeCollapse file tree

2 files changed

+6
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-3
lines changed
Open diff view settings
Collapse file

‎lib/querystring.js‎

Copy file name to clipboardExpand all lines: lib/querystring.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ function unescapeBuffer(s, decodeSpaces) {
9494
hexHigh = unhexTable[currentChar];
9595
if (!(hexHigh >= 0)) {
9696
out[outIndex++] = 37; // '%'
97+
continue;
9798
} else {
9899
nextChar = s.charCodeAt(++index);
99100
hexLow = unhexTable[nextChar];
100101
if (!(hexLow >= 0)) {
101102
out[outIndex++] = 37; // '%'
102-
out[outIndex++] = currentChar;
103-
currentChar = nextChar;
103+
index--;
104104
} else {
105105
hasHex = true;
106106
currentChar = hexHigh * 16 + hexLow;
Collapse file

‎test/parallel/test-querystring.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-querystring.js
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ const qsUnescapeTestCases = [
175175
['there%2Qare%0-fake%escaped values in%%%%this%9Hstring',
176176
'there%2Qare%0-fake%escaped values in%%%%this%9Hstring'],
177177
['%20%21%22%23%24%25%26%27%28%29%2A%2B%2C%2D%2E%2F%30%31%32%33%34%35%36%37',
178-
' !"#$%&\'()*+,-./01234567']
178+
' !"#$%&\'()*+,-./01234567'],
179+
['%%2a', '%*'],
180+
['%2sf%2a', '%2sf*'],
181+
['%2%2af%2a', '%2*f*']
179182
];
180183

181184
assert.strictEqual(qs.parse('id=918854443121279438895193').id,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.