-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
url: use resolved path to convert to fileURL
#56302
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #56302 +/- ##
==========================================
+ Coverage 88.04% 88.54% +0.49%
==========================================
Files 657 657
Lines 190290 190398 +108
Branches 36245 36551 +306
==========================================
+ Hits 167536 168580 +1044
+ Misses 15893 14998 -895
+ Partials 6861 6820 -41
|
lib/internal/url.js
Outdated
@@ -1512,32 +1512,32 @@ function fileURLToPath(path, options = kEmptyObject) { | |||
|
|||
function pathToFileURL(filepath, options = kEmptyObject) { | |||
const windows = options?.windows ?? isWindows; | |||
if (windows && StringPrototypeStartsWith(filepath, '\\\\')) { | |||
let resolved = windows ? path.win32.resolve(filepath) : path.posix.resolve(filepath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of introducing a new variable named resolved
and renaming the existing parameter filepath
, rename the input parameter to filepathOriginal
and create a new variable filepath
for the modified version of the original path.
let resolved = windows ? path.win32.resolve(filepath) : path.posix.resolve(filepath); | |
let filepath = windows ? path.win32.resolve(filepathOriginal) : path.posix.resolve(filepathOriginal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not introducing it, it already exists; I'm only moving its declaration upper.
@@ -1512,32 +1512,32 @@ function fileURLToPath(path, options = kEmptyObject) { | |||
|
|||
function pathToFileURL(filepath, options = kEmptyObject) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filepathOriginal
or filepathUnresolved
Let's not start another CI until I've investigated the Windows failure |
Only matters if the CWD is a UNC path, which is hard to write a test for.
Fixes: #56262