Skip to content

Commit

Permalink
feat(lib): [pathToFileURL] platform defaults
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <[email protected]>
  • Loading branch information
unicornware committed Sep 22, 2024
1 parent 9883d58 commit a61c416
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/path-to-file-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @module pathe/lib/pathToFileURL
*/

import { isWindows } from '#internal/constants'
import domainToASCII from '#internal/domain-to-ascii'
import validateString from '#internal/validate-string'
import {
Expand Down Expand Up @@ -55,7 +56,10 @@ function pathToFileURL(
// handle extended and standard UNC path
// "\\?\UNC\" path prefix should be ignored.
// ref: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
if (options?.windows && path.startsWith(sep.repeat(2))) {
if (
(options?.windows ?? /* c8 ignore next */ isWindows) &&
path.startsWith(sep.repeat(2))
) {
/**
* Length of UNC path prefix.
*
Expand Down

0 comments on commit a61c416

Please sign in to comment.