mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-24 08:38:51 -05:00
Issue 2784: Cannot set server hostname
Loosened the restrictions on the TLD to support custom private TLD's, as well as single label hostnames. Removed the localhost and localhost.localdomain exceptions, as they are now redundant.
This commit is contained in:
parent
91ef3b50f2
commit
bdcb19e344
@ -108,15 +108,13 @@ public class Utility {
|
||||
public static boolean domainFieldValid(EditText view) {
|
||||
if (view.getText() != null) {
|
||||
String s = view.getText().toString();
|
||||
if (s.matches("^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}$")) {
|
||||
if (s.matches("^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)*[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?$") &&
|
||||
s.length() <= 253) {
|
||||
return true;
|
||||
}
|
||||
if (s.matches("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$")) {
|
||||
return true;
|
||||
}
|
||||
if ((s.equalsIgnoreCase("localhost")) || (s.equalsIgnoreCase("localhost.localdomain"))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user