-
Notifications
You must be signed in to change notification settings - Fork 16
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
IBX-9217: Added URL validation #1418
base: 4.6
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand it, this will approve all valid URLs no matter the protocol. If we later want to introduce an FT setting to only allow certain protocols, we can support that here by checking the url protocol property.
In this implementation, I’m checking if string is a valid url, no matter what the protocol is, as long as it is actually a protocol :) but we can later add additional protocol validation via property
|
79e777a
to
8a32b7e
Compare
result.errorMessage = ibexa.errors.emptyField.replace('{fieldName}', label); | ||
} | ||
|
||
if (!isEmpty) { | ||
try { | ||
new URL(urlValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of doing this whole try catch you can do normal if using static method canParse https://developer.mozilla.org/en-US/docs/Web/API/URL/canParse_static
6017ddd
to
7142014
Compare
|
Description:
For QA:
Documentation: