[Validator] Accept underscores in the URL validator as the URL will resolve correctly
This commit is contained in:
parent
ad66a160b1
commit
c9c7a1118c
@ -25,7 +25,7 @@ class UrlValidator extends ConstraintValidator
|
|||||||
(%s):// # protocol
|
(%s):// # protocol
|
||||||
(([\.\pL\pN-]+:)?([\.\pL\pN-]+)@)? # basic auth
|
(([\.\pL\pN-]+:)?([\.\pL\pN-]+)@)? # basic auth
|
||||||
(
|
(
|
||||||
([\pL\pN\pS\-\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
|
([\pL\pN\pS\-\_\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
|
||||||
| # or
|
| # or
|
||||||
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address
|
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address
|
||||||
| # or
|
| # or
|
||||||
|
@ -72,6 +72,8 @@ class UrlValidatorTest extends ConstraintValidatorTestCase
|
|||||||
['http://www.example.museum'],
|
['http://www.example.museum'],
|
||||||
['https://example.com/'],
|
['https://example.com/'],
|
||||||
['https://example.com:80/'],
|
['https://example.com:80/'],
|
||||||
|
['http://examp_le.com'],
|
||||||
|
['http://www.sub_domain.examp_le.com'],
|
||||||
['http://www.example.coop/'],
|
['http://www.example.coop/'],
|
||||||
['http://www.test-example.com/'],
|
['http://www.test-example.com/'],
|
||||||
['http://www.symfony.com/'],
|
['http://www.symfony.com/'],
|
||||||
@ -152,7 +154,6 @@ class UrlValidatorTest extends ConstraintValidatorTestCase
|
|||||||
['://example.com'],
|
['://example.com'],
|
||||||
['http ://example.com'],
|
['http ://example.com'],
|
||||||
['http:/example.com'],
|
['http:/example.com'],
|
||||||
['http://examp_le.com'],
|
|
||||||
['http://example.com::aa'],
|
['http://example.com::aa'],
|
||||||
['http://example.com:aa'],
|
['http://example.com:aa'],
|
||||||
['ftp://example.fr'],
|
['ftp://example.fr'],
|
||||||
|
Reference in New Issue
Block a user