Skip to content

Commit dd7da4c

Browse files
committed
lib, url: add a windows option to path parsing
nodejs/node#52509
1 parent f4337ca commit dd7da4c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,13 @@ diff --git a/lib/internal/url.js b/lib/internal/url.js
111111
index 428c2f1bec4a8e149b8058406d1393a6690ff31a..979455cb44f5edba6d178a6c36a330d707a2395e 100644
112112
--- a/lib/internal/url.js
113113
+++ b/lib/internal/url.js
114-
@@ -1457,6 +1457,8 @@ function fileURLToPath(path) {
114+
@@ -1459,6 +1459,8 @@ function fileURLToPath(path, options = kEmptyObject) {
115115
path = new URL(path);
116116
else if (!isURL(path))
117117
throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path);
118118
+ if (path.protocol === 'electron:')
119119
+ return 'electron';
120120
if (path.protocol !== 'file:')
121121
throw new ERR_INVALID_URL_SCHEME('file');
122-
return isWindows ? getPathFromURLWin32(path) : getPathFromURLPosix(path);
122+
return (windows ?? isWindows) ? getPathFromURLWin32(path) : getPathFromURLPosix(path);
123+

0 commit comments

Comments
 (0)