bug: path without trailing slash gets 404 error for relative links on page
In continuation of the conversation https://github.com/JustinBeckwith/linkinator/issues/34#issuecomment-499075791
We're using the Linkinator in our Neon docs.
On the page https://neon.tech/docs/reference/api-reference/ there are two relative links:

You can check, that them are perfectly working in browser. Also, these links are web-correct.
And when I'm checking this page by the Linkinator:
npm run check:broken-links -- https://neon.tech/docs/reference/api-reference
I'm getting errors:
{
"links": [
{
"url": "https://neon.tech/manage/api-keys",
"status": 404,
"state": "BROKEN",
"parent": "https://neon.tech/docs/reference/api-reference"
},
{
"url": "https://neon.tech/manage/branches/",
"status": 404,
"state": "BROKEN",
"parent": "https://neon.tech/docs/reference/api-reference"
}
],
"passed": false
}
But! If I'm passing to the Linkinator the same link with trailing slash:
npm run check:broken-links -- https://neon.tech/docs/reference/api-reference/
There are no errors:
{
"links": [],
"passed": true
}
I think the problem is that the Linkinator is cutting end part of path for relative links before concat it with relative href:
https://neon.tech/docs/reference/api-reference > https://neon.tech/docs/reference/ > https://neon.tech/docs/reference/ + ../../manage/api-keys = https://neon.tech/manage/api-keys
+1, also happens here.
Example:
-
https://engine.needle.tools/samples-uploads/pencil-sword(logs missing links with incorrect links) -
https://engine.needle.tools/samples-uploads/pencil-sword/(works fine)
@JustinBeckwith mind taking a look? :)