diff --git a/src/index.js b/src/index.js index 99b09be..4de3307 100644 --- a/src/index.js +++ b/src/index.js @@ -71,7 +71,8 @@ const customRule = { if (hrefSrc != null) { const url = new URL(hrefSrc, pathToFileURL(params.name)) url.hash = '' - const isRelative = url.protocol === 'file:' + const isRelative = + url.protocol === 'file:' && !hrefSrc.startsWith('/') if (isRelative && !fs.existsSync(url)) { const detail = `Link "${hrefSrc}" is dead` addError(onError, lineNumber, detail) diff --git a/test/fixtures/Valid.md b/test/fixtures/Valid.md index 35fa567..327d56a 100644 --- a/test/fixtures/Valid.md +++ b/test/fixtures/Valid.md @@ -4,6 +4,8 @@ ![Image](./image.png) +![Absolute Path](/absolute/path.png) + [External https link](https://example.com/) [External https link 2](https:./external.https)