Joi.string().uri() fails to validate uri with 2 #, but new URL() works
- Dominant language
- JavaScript
- Stars
- 21.2k
- Forks
- 1.5k
- Avg merge
- 4h 57m
- Merged PRs (30d)
- 14
Description
#### Support plan
* *is this issue currently blocking your project?* (yes/no): Yes
* *is this issue affecting a production system?* (yes/no): No
#### Context
* *node version*: 12
* *module version with issue*: 17.1.1
* *environment* (e.g. node, browser, native): node
Related: https://github.com/facebook/docusaurus/issues/3219
#### What are you trying to achieve or the steps to reproduce?
Code sandbox: https://codesandbox.io/s/joi-validation-interactive-52stl?file=/src/index.js:292-386
```js
Joi.string()
.uri()
.validate("https://riot.im/app/#/room/#ligo-public:matrix.org")
```
#### What was the result you got?
```
console.log(
Joi.string()
.uri()
.validate("https://riot.im/app/#/room/#ligo-public:matrix.org"),
);
console.log(new URL("https://riot.im/app/#/room/#ligo-public:matrix.org"));
```
Joi returns an error, while the URL is parseable
#### What result did you expect?
Joi does not return an error
Contributor guide
Assessment
This issue has not been assessed yet.