Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joi.string().uri() fails to validate uri with 2 #, but new URL() works #2435

Open
slorber opened this issue Aug 5, 2020 · 0 comments
Open

Comments

@slorber
Copy link

slorber commented Aug 5, 2020

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: facebook/docusaurus#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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant