python-validators / validators

Python Data Validation for Humans™.
MIT License
977 stars 155 forks source link

Wrong behavior of URL validator for domain with 2 dashes #187

Closed nitr0man closed 1 year ago

nitr0man commented 3 years ago

There is an error in URL validation when domain have two dashes. Domain validator passed such domains successfully.

In [1]: import validators                                                                                                                                                                                                                     

In [2]: validators.domain('foo-bar.com')                                                                                                                                                                                                      
Out[2]: True

In [3]: validators.domain('foo--bar.com')                                                                                                                                                                                                     
Out[3]: True

In [4]: validators.url('http://foo-bar.com')                                                                                                                                                                                                  
Out[4]: True

In [5]: validators.url('http://foo--bar.com')                                                                                                                                                                                                 
Out[5]: ValidationFailure(func=url, args={'value': 'http://foo--bar.com', 'public': False})