From 0008c097b70834109e3b58042fd89acaaade20c3 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 26 Dec 2022 01:36:42 +0100 Subject: [PATCH] do not harden in case that helps --- lib/internal/url.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/internal/url.js b/lib/internal/url.js index 571367a7e1ada6..50c8c74f185a24 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -34,7 +34,6 @@ const { SymbolIterator, SymbolToStringTag, decodeURIComponent, - hardenRegExp, } = primordials; const { inspect } = require('internal/util/inspect'); @@ -117,7 +116,7 @@ const { revokeDataObject, } = internalBinding('blob'); -const FORWARD_SLASH = hardenRegExp(/\//g); +const FORWARD_SLASH = (/\//g; const context = Symbol('context'); const cannotBeBase = Symbol('cannot-be-base'); @@ -1505,11 +1504,11 @@ function fileURLToPath(path) { // - CR: The carriage return character is also stripped out by the `pathname` // setter. // - TAB: The tab character is also stripped out by the `pathname` setter. -const percentRegEx = hardenRegExp(/%/g); -const backslashRegEx = hardenRegExp(/\\/g); -const newlineRegEx = hardenRegExp(/\n/g); -const carriageReturnRegEx = hardenRegExp(/\r/g); -const tabRegEx = hardenRegExp(/\t/g); +const percentRegEx = (/%/g; +const backslashRegEx = (/\\/g; +const newlineRegEx = (/\n/g; +const carriageReturnRegEx = (/\r/g; +const tabRegEx = (/\t/g; function encodePathChars(filepath) { if (StringPrototypeIncludes(filepath, '%'))