diff options
author | Peter Wu | 2018-08-15 18:40:48 +0200 |
---|---|---|
committer | Peter Wu | 2018-08-15 18:40:48 +0200 |
commit | 49e34cd176241d8f5caad1035159564a06715d74 (patch) | |
tree | ea187b66b92a341b7d146f088d443be0b3a90da9 /src/lib | |
parent | 2c75eedadddd8bda0522cddaf119e1e5c621c7c2 (diff) | |
download | noscript-49e34cd176241d8f5caad1035159564a06715d74.tar.gz noscript-49e34cd176241d8f5caad1035159564a06715d74.tar.xz noscript-49e34cd176241d8f5caad1035159564a06715d74.zip |
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.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/tld.js | 4 |
1 files changed, 3 insertions, 1 deletions
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; |