From b3563e85691f0a3da97ccc2c96d446730d4c65ac Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Wed, 2 Sep 2020 03:34:41 +0900 Subject: fix(URLSearchParams): fix handling of + character (#7314) --- cli/rt/11_url.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cli/rt') diff --git a/cli/rt/11_url.js b/cli/rt/11_url.js index 5de6cc8c7..86dcbf26d 100644 --- a/cli/rt/11_url.js +++ b/cli/rt/11_url.js @@ -14,6 +14,10 @@ return sendSync("op_domain_to_ascii", { domain, beStrict }); } + function decodeSearchParam(p) { + return decodeURIComponent(p.replace(/\+/g, " ")); + } + const urls = new WeakMap(); class URLSearchParams { @@ -63,7 +67,7 @@ const position = pair.indexOf("="); const name = pair.slice(0, position === -1 ? pair.length : position); const value = pair.slice(name.length + 1); - this.#append(decodeURIComponent(name), decodeURIComponent(value)); + this.#append(decodeSearchParam(name), decodeSearchParam(value)); } }; -- cgit v1.2.3