From 49e34cd176241d8f5caad1035159564a06715d74 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Wed, 15 Aug 2018 18:40:48 +0200 Subject: 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. --- src/lib/tld.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/tld.js b/src/lib/tld.js index 78dc029..8789477 100644 --- a/src/lib/tld.js +++ b/src/lib/tld.js @@ -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; -- cgit v1.2.3