-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
string().uri() not working with accented characters #2889
Comments
Hello, @mlarcher. I think if you do something like const encodedUsername = encodeURIComponent('aïssa');
const { error } = Joi.string().uri().validate(`https://linkedin.com/in/${encodedUsername}`);
console.log(error); // undefined it might work. However, I also think it could be handled by the lib. |
It is rejected because it is invalid. There's a well-written answer on SO. |
I understand the rationale behind it, but don't you think that we could have a setting to allow urls that are not RFC compliant but widely used and accepted in all major browsers ? For instance, if a user copy/pastes a LinkedIn url from her browser, I would expect Joi to provide a way to recognize it as valid, be it through an option. |
Browsers accept about anything, they just run |
The linkedin url used in our example came into our subscription form. We want to validate it is a correct/usable url. Joi says it isn't even though to us it is... |
This sounds a lot like raw text copy-pasting, a browser wouldn't provide that. I'm not going to change the validation part ( |
I'd be glad to, but I don't have enough spare time at the moment to handle that I'm afraid |
Can I try this issue? |
Sure! Be careful to target v17 branch, the main branch is currently in progress. |
I submitted a PR for this. Please take a look when you have a chance. Thanks! |
Hi, |
Do you mean an extension? That could have some unintended consequences. Depending on how it's implemented, you can maybe force this, but I'd rather have extension providers offer that option if relevant. |
What I mean is, if I pass Thanks |
|
Oh, I'm sorry, I wasted your time. I was experiencing an error saying I couldn't use the Thanks |
Support plan
Context
What are you trying to achieve or the steps to reproduce?
What was the result you got?
What result did you expect?
no error
Same check with a
i
instead of theï
inaïssa
in the url works as expectedThe text was updated successfully, but these errors were encountered: