Fails on `mailto:` links
- Dominant language
- JavaScript
- Stars
- 18
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
`runValidator` fails with an exception when a `mailto:` URL is found in the page. The application then terminates with:
```
internal/validators.js:112
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object
at validateString (internal/validators.js:112:11)
at Object.basename (path.js:1157:5)
at runValidator (/home/eon/eon-com-relaunch/node_modules/w3c-link-validator/src/w3clink.js:72:22)
at Request._callback (/home/eon/eon-com-relaunch/node_modules/w3c-link-validator/src/w3clink.js:120:13)
at Request.self.callback (/home/eon/eon-com-relaunch/node_modules/request/request.js:185:22)
at Request.emit (events.js:210:5)
at Request. (/home/eon/eon-com-relaunch/node_modules/request/request.js:1161:10)
at Request.emit (events.js:210:5)
at IncomingMessage. (/home/eon/eon-com-relaunch/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:299:28) {
code: 'ERR_INVALID_ARG_TYPE'
}
```
I have been able to resolve this by replacing
```
var _base = path.basename(urlinfo.pathname);
```
with
```
var _base = path.basename(urlinfo.pathname || urlinfo.href);
```
but I haven't really tested it.
Contributor guide
Research direction
Start in node_modules/w3c-link-validator/src/w3clink.js at runValidator and reproduce the exception with a mailto: URL. Verify that mailto: links no longer terminate the application and add or run a regression check if the repository provides one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100