Skip to content

Commit

Permalink
fixup! url: use resolved path to convert UNC paths to URL
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Dec 23, 2024
1 parent 6708d1c commit 85afa77
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -1512,8 +1512,11 @@ function fileURLToPath(path, options = kEmptyObject) {

function pathToFileURL(filepath, options = kEmptyObject) {
const windows = options?.windows ?? isWindows;
let resolved = windows ? path.win32.resolve(filepath) : path.posix.resolve(filepath);
if (windows && StringPrototypeStartsWith(resolved, '\\\\')) {
const isUNC = windows && StringPrototypeStartsWith(filepath, '\\\\');
let resolved = isUNC ?
filepath :
(windows ? path.win32.resolve(filepath) : path.posix.resolve(filepath));
if (isUNC || windows && StringPrototypeStartsWith(resolved, '\\\\')) {

Check failure on line 1519 in lib/internal/url.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Unexpected mix of '||' and '&&'. Use parentheses to clarify the intended order of operations

Check failure on line 1519 in lib/internal/url.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Unexpected mix of '||' and '&&'. Use parentheses to clarify the intended order of operations
// UNC path format: \\server\share\resource
// Handle extended UNC path and standard UNC path
// "\\?\UNC\" path prefix should be ignored.
Expand Down

0 comments on commit 85afa77

Please sign in to comment.