Fix policy configuration for domains without dots

Make sure that hosts such as "_gateway" (from systemd nss-myhostname) or
"master" (a local domain from DHCP) can be configured in the popup.
This commit is contained in:
Peter Wu 2018-08-15 18:40:48 +02:00
parent 2c75eedadd
commit 49e34cd176
1 changed files with 3 additions and 1 deletions

View File

@ -12,9 +12,11 @@ var tld = {
pos = domain.search(this._tldRx);
if (pos === -1) {
// TLD not in the public suffix list, fall back to the "one-dot rule"
// (for a.b.c.tld, assume the domain to be "c.tld")
pos = domain.lastIndexOf(".");
if (pos === -1) {
return "";
// No dots at all? Likely a private domain in a LAN.
return domain;
}
}
pos = domain.lastIndexOf(".", pos - 1) + 1;