Skip to content

Commit

Permalink
lib, url: add a windows option to path parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed May 31, 2024
1 parent f4337ca commit dd7da4c
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ diff --git a/lib/internal/url.js b/lib/internal/url.js
index 428c2f1bec4a8e149b8058406d1393a6690ff31a..979455cb44f5edba6d178a6c36a330d707a2395e 100644
--- a/lib/internal/url.js
+++ b/lib/internal/url.js
@@ -1457,6 +1457,8 @@ function fileURLToPath(path) {
@@ -1459,6 +1459,8 @@ function fileURLToPath(path, options = kEmptyObject) {
path = new URL(path);
else if (!isURL(path))
throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path);
+ if (path.protocol === 'electron:')
+ return 'electron';
if (path.protocol !== 'file:')
throw new ERR_INVALID_URL_SCHEME('file');
return isWindows ? getPathFromURLWin32(path) : getPathFromURLPosix(path);
return (windows ?? isWindows) ? getPathFromURLWin32(path) : getPathFromURLPosix(path);

0 comments on commit dd7da4c

Please sign in to comment.