summaryrefslogtreecommitdiff
path: root/std/path/posix.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/path/posix.ts')
-rw-r--r--std/path/posix.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/std/path/posix.ts b/std/path/posix.ts
index 03d07a84a..3c4262203 100644
--- a/std/path/posix.ts
+++ b/std/path/posix.ts
@@ -435,5 +435,6 @@ export function parse(path: string): ParsedPath {
* are ignored.
*/
export function fromFileUrl(url: string | URL): string {
- return new URL(String(url)).pathname;
+ return (url instanceof URL ? url : new URL(url)).pathname
+ .replace(/^\/*([A-Za-z]:)(\/|$)/, "$1/");
}