Skip to content

Commit

Permalink
Percent decode
Browse files Browse the repository at this point in the history
  • Loading branch information
slowcheetah committed Aug 12, 2024
1 parent 75fdae9 commit 598d3de
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/core-js/modules/web.url-search-params.constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ var splice = uncurryThis([].splice);
var split = uncurryThis(''.split);
var stringSlice = uncurryThis(''.slice);

var plus = /\+/g;
var FALLBACK_REPLACER = '\uFFFD';
var charCodeAt = uncurryThis(''.charCodeAt);
var indexOf = uncurryThis(''.indexOf);
var numberToString = uncurryThis(1.0.toString);
var fromCharCode = uncurryThis(''.fromCharCode);
var fromCharCode = String.fromCharCode;
var fromCodePoint = getBuiltIn('String', 'fromCodePoint');
var $parseInt = parseInt;

Expand Down Expand Up @@ -176,6 +177,11 @@ var decode = function (input) {
return result;
};

var deserialize = function (it) {
var result = replace(it, plus, ' ');
return decode(result);
}

var find = /[!'()~]|%20/g;

var replacements = {
Expand Down Expand Up @@ -266,8 +272,8 @@ URLSearchParamsState.prototype = {
if (attribute.length) {
entry = split(attribute, '=');
push(entries, {
key: decode(shift(entry)),
value: decode(join(entry, '='))
key: deserialize(shift(entry)),
value: deserialize(join(entry, '='))
});
}
}
Expand Down

0 comments on commit 598d3de

Please sign in to comment.