Skip to content

Commit

Permalink
Percent decode
Browse files Browse the repository at this point in the history
  • Loading branch information
slowcheetah committed Aug 13, 2024
1 parent 3f75274 commit f012003
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/core-js/modules/web.url-search-params.constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,22 @@ var decode = function (input) {
var decodedChar = input[i];

if (decodedChar === '%') {
if (i + 3 > length) {
if (i + 3 > length && i + 1 !== length) {
result += FALLBACK_REPLACER;
break;
}

if (input[i + 1] === '%') {
if (input[i + 1] === '%' || i + 1 === length) {
result += '%';
i++;
continue;
}

var octet = parseHexOctet(input, i + 1);

if (isNaN(octet)) {
result += FALLBACK_REPLACER;
i += 3;
if (isNaN(octet) || octet < 32) {
result += decodedChar;
i++;
continue;
}

Expand Down

0 comments on commit f012003

Please sign in to comment.