Ticket #969 (fixed bug)
New TLDs not allowed as valid URLs
- Created: 2014-05-08 14:16:50
- Reported by: Franz
- Assigned to: quy
- Milestone: 1.5.8
- Component: code
- Priority: normal
For things like the website field in user profiles.
Forum topic: https://fluxbb.org/forums/viewtopic.php?id=7757
History

Here is my solution:
Get the latest tlds from here: http://www.icann.org/en/resources/registries/tlds
Omit 2 letter tlds since they will be accounted in the regex to reduce list to 384 tlds.
Save to file.
In the url_valid function, include the file and replace the following:
com|edu|gov|int|mil|net|org|biz|
info|name|pro|aero|coop|museum|
asia|cat|jobs|mobi|tel|travel|
Thoughts?
seven 2014-05-09 07:20:58

Accept any TLD.
1) Virtually any TLD is acceptable now (gTLDs).
2) It's not a forum's job to check their existence. Why should it even bother?
3) okay, let's assume we want to be the new userinput nazis. We'd have to fetch the updated TLD list every time the user inserts a new TLD not present in the list, to see if it was accepted in the meantime.
4) It would be better to use DNS resolving then, instead of fetching a big TLD list.
Franz 2014-05-10 10:50:32

Oh nice, we have to reserve www.fluxbb.blackfriday!
Let's just modify the regex to accept any valid-ish URLs without verifying the TLD. That just doesn't make sense these days. Also, anybody can add custom domain names in their hosts file, and something might break in some weird intranet, if we just artificially set a limit.

Are you suggesting let it be free form with no validations other than 100 characters for this field as defined in the users table?
Mpok 2014-05-11 23:08:53

As Franz said #3, we can't validate tld.
And thanks to Different55 for signaling the pbm… (note : u tend to forget ur contributors… Should have a clear mention on every ticket, same way as 'Created' ; ok there is the forum link, but still…).
For the pbm : as quy said, it looks awful to "leave up"…
Is there any 'rules' about new TLDs ? (length, caracters, etc…)

How about changing as follows:
(?: # Explicitly specify top level domains.
com|edu|gov|int|mil|net|org|biz|
info|name|pro|aero|coop|museum|
asia|cat|jobs|mobi|tel|travel|
[A-Za-z]{2}) # Country codes are exqactly two alpha chars.
to:
(?: # Top level domains
[A-Za-z]{2,25}| # Country codes are exactly two alpha chars.
xn--[0-9A-Za-z]{4,25}) # Internationalized Domain Name (IDN)
Studio384 2014-07-05 13:04:10

It should be 63 in theory, as that is the maximum amount of characters in a TLD allowed by DNS.

Per the current List of Top-Level Domains, the highest length for gTLD is 14 and for IDN is 22 as of today. I arbitrarily selected 25. Lets decide on a number, but keep in mind that there is an 80 characters limit on the Website field per the maxlength attribute.