-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add Validator infrastructure #27961
Add Validator infrastructure #27961
Conversation
d5d86b1
to
e1e549e
Compare
Mind to squash to a single commit? :) |
10a4cec
to
abfe172
Compare
CI is unhappy tho |
abfe172
to
24db036
Compare
It's a bit weird that the ci report a failure for continuous-integration/drone/pr but in https://drone.nextcloud.com/nextcloud/server/7311 everything is green |
What about https://drone.nextcloud.com/nextcloud/server/7311/9/4 😉
|
It seems A better solution would be either to just copy the UrlValidator::validate from symfony/validator or just depends on symfony/validator and use it for all kind of validations in Nextcloud (URL, email, date ...). For reference, this is the method: https://github.com/symfony/validator/blob/14337bdf9e2e0b2e3385c9e90f13325f0c95a4f9/Constraints/UrlValidator.php#L24 |
That's probably because it's made to handle domains, not full URIs. You could extract the hostname with But using the regex from SF Validator makes sense too. |
b8d57ec
to
e693979
Compare
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.
Apart from that, code looks good. Didn't try it though.
e62819d
to
1fd5538
Compare
What is missing here? |
1fd5538
to
bc4d71b
Compare
bc4d71b
to
604ee19
Compare
conflicts :/ |
Originally this PR tried to fix the validation of URLs, but the scope of this
changed to instead provide a generic interface for validating user input,
configs, ... The theming API was ported to it as example and to fix the
original bug.
The API is based on Symfony Validator component but the implementation
is simplified a lot since we don't support (yet) validating class with annotation
and other more complicated (and useful) stuff.
The filter_var function is unfortunately not perfect and doesn't supportdomain with unicode as well as url with underscores. Replace usage with
a regex.
See https://bugs.php.net/search.php?cmd=display&search_for=FILTER_VALIDATE_URLCloses #27906
Signed-off-by: Carl Schwan [email protected]