Skip to content

Commit 7e57b16

Browse files
committed
fixup! windows paths double slash, coverage
1 parent ab15ea4 commit 7e57b16

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/npa.js

+8
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ function isFileSpec (spec) {
6666
if (isWindows) {
6767
return isWindowsFile.test(spec)
6868
}
69+
// We never hit this in windows tests, obviously
70+
/* istanbul ignore next */
6971
return isPosixFile.test(spec)
7072
}
7173

@@ -342,6 +344,12 @@ function fromFile (res, where) {
342344
res.fetchSpec = path.resolve(where, resolvedPath)
343345
// re-normalize the slashes in saveSpec due to node:path/win32 behavior in windows
344346
res.saveSpec = res.saveSpec.split('\\').join('/')
347+
// Ignoring because this only happens in windows
348+
/* istanbul ignore next */
349+
if (res.saveSpec.startsWith('file://')) {
350+
// normalization of \\win32\root paths can cause a double / which we don't want
351+
res.saveSpec = `file:/${res.saveSpec.slice(7)}`
352+
}
345353
return res
346354
}
347355

0 commit comments

Comments
 (0)