From d0c2714c033b010cbd174138638881dc65abef06 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Tue, 13 Oct 2020 16:16:10 +0100 Subject: fix(op_crates/web/url): apply backslash replacement to the pathname setter (#7937) --- op_crates/web/11_url.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'op_crates') diff --git a/op_crates/web/11_url.js b/op_crates/web/11_url.js index fe7ef041a..f2d12f5be 100644 --- a/op_crates/web/11_url.js +++ b/op_crates/web/11_url.js @@ -378,7 +378,7 @@ return null; } [parts.path, restUrl] = takePattern(restUrl, /^([^?#]*)/); - parts.path = encodePathname(parts.path.replace(/\\/g, "/")); + parts.path = encodePathname(parts.path); if (usedNonBase) { parts.path = normalizePath(parts.path, parts.protocol == "file"); } else { @@ -870,7 +870,9 @@ } function encodePathname(s) { - return [...s].map((c) => (charInPathSet(c) ? encodeChar(c) : c)).join(""); + return [...s.replace(/\\/g, "/")].map(( + c, + ) => (charInPathSet(c) ? encodeChar(c) : c)).join(""); } function encodeSearch(s, isSpecial) { -- cgit v1.2.3