From 173d0800e619fc002bd605fdcc8339ab65a01749 Mon Sep 17 00:00:00 2001 From: Aidan Welch Date: Sun, 3 Sep 2023 02:27:15 +0200 Subject: [PATCH] url: fix toPathIfFileUrl with string URL input --- lib/internal/url.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/url.js b/lib/internal/url.js index 92d5e84e87c71f..2ca1d0cf44a16b 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -1491,7 +1491,7 @@ function pathToFileURL(filepath) { } function toPathIfFileURL(fileURLOrPath) { - if (!isURL(fileURLOrPath)) + if (!isURL(fileURLOrPath) && !(typeof fileURLOrPath === 'string' && fileURLOrPath.startsWith('file://'))) return fileURLOrPath; return fileURLToPath(fileURLOrPath); }