fix: ignore absolute paths /absolute/path

This commit is contained in:
Divlo 2023-04-02 21:10:47 +02:00
parent 77b8988bea
commit c985af6156
No known key found for this signature in database
GPG Key ID: 8F9478F220CE65E9
2 changed files with 4 additions and 1 deletions

View File

@ -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)

View File

@ -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)