validators
validators copied to clipboard
isUrl not validating tld
Given the following website:
website = http://www.example
When I call isURL on it with the following options, I get true, when I expected to get false as this is not a valid URL. I understand the requireTld option defaults to true.
isURL(website, requireProtocol: true, allowUnderscore: true)
I am using version ^2.0.0+1
I ran into this and was confused as well, and wound up here. But upon further thought, this is kind of tricky unless the package keeps a list of valid TLDs. For example, http://www.com is actually a valid URL (equivalent to www.www.com). Therefore so are all kinds of crazy domains like http://www.pizza.
One option could be to provide a way to ignore URLs of the pattern "www.TLD". Either as an optional parameter, or maybe the existing hostBlacklist could be modified to support wildcard patterns