From 10e4af3280fc4f33597a35f23b80abcb842f703b Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki Date: Tue, 21 May 2024 19:18:20 +0700 Subject: [PATCH] fix: Resolve unchecked path for non-Windows systems --- src/lsfnd.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lsfnd.ts b/src/lsfnd.ts index 329758b..bbf78e4 100644 --- a/src/lsfnd.ts +++ b/src/lsfnd.ts @@ -169,7 +169,8 @@ function resolveFileURL(p: StringPath): StringPath { if (/^file:(?:\/\/\/?)$/.test(p)) p = '/'; // Otherwise, parse the file URL path else p = fileURLToPath(p); - } else if ((os.platform() !== 'win32' && isWin32Path(p)) + } else if ((os.platform() !== 'win32' + && (isWin32Path(p) || !p.startsWith('file:'))) || (os.platform() === 'win32' && !(isWin32Path(p) || p.startsWith('file:')))) { throw new URIError('Invalid file URL scheme');