Skip to content

Fails on mailto: links #60

Open
Open
@rondonjon

Description

@rondonjon

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.<anonymous> (/home/eon/eon-com-relaunch/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:210:5)
    at IncomingMessage.<anonymous> (/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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions