querystring: manage percent character at unescape

Related: https://github.com/nodejs/node/issues/33892
Fixes: https://github.com/nodejs/node/issues/35012

PR-URL: https://github.com/nodejs/node/pull/35013
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Daijiro Wachi 2020-09-02 03:23:13 +09:00 committed by Rich Trott
parent 07423b5472
commit 3b925219c3
2 changed files with 6 additions and 3 deletions

View file

@ -94,13 +94,13 @@ function unescapeBuffer(s, decodeSpaces) {
hexHigh = unhexTable[currentChar];
if (!(hexHigh >= 0)) {
out[outIndex++] = 37; // '%'
continue;
} else {
nextChar = s.charCodeAt(++index);
hexLow = unhexTable[nextChar];
if (!(hexLow >= 0)) {
out[outIndex++] = 37; // '%'
out[outIndex++] = currentChar;
currentChar = nextChar;
index--;
} else {
hasHex = true;
currentChar = hexHigh * 16 + hexLow;