validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

isURL always checks host even if no host specified but query and path are

Open mortbauer opened this issue 3 years ago • 0 comments

Describe the bug Although trying to be generic for different protocols the isURL check always valdiates hosts even if no host specified.

Examples My use case is to validate a postgresql uri with using a unix socket which could look like:

postgres://user:pw@/test?host=/var/run/postgresql

isURL always returns false, not matter which options specified, even with require_host=false.

if i change the url to:

postgres://user:[email protected]/test?host=/var/run/postgresql

it would validate to true.

Additional context Validator.js version: 13.7.0 (current HEAD) Node.js version: doesn't matter OS platform: doesn't matter

mortbauer avatar Jul 02 '22 06:07 mortbauer