We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ae1455c commit 5cc78cbCopy full SHA for 5cc78cb
src/no-dead-link.ts
@@ -258,7 +258,14 @@ async function isAliveLocalFile(filePath: string): Promise<AliveFunctionReturn>
258
let pathToCheck = filePath;
259
if (filePath.startsWith("file://")) {
260
const url = URL.parse(filePath);
261
- pathToCheck = url ? url.pathname : filePath;
+ if (url && url.pathname) {
262
+ // On Windows, pathname starts with / for drive letters (e.g., /C:/path)
263
+ // We need to remove the leading slash for Windows paths
264
+ pathToCheck =
265
+ process.platform === "win32" && url.pathname.match(/^\/[A-Za-z]:/)
266
+ ? url.pathname.slice(1)
267
+ : url.pathname;
268
+ }
269
}
270
await fs.access(pathToCheck.replace(/[?#].*?$/, ""));
271
return {
0 commit comments